Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Proper syntax within php print statement?


mugitty

Recommended Posts

Posted

Can anyone tell me the proper syntax to use to enter a dynamic item within a php print statement? (On product_info.php)

 

<?php

$prod_quantity = tep_get_products_stock($products_id);

switch ($prod_quantity) {

case 0:

print "<a href="mailto:[email protected]?subject=Freight Quote Request - I want to enter the product_model here"><font color=red>email</font></a> us for a quote";

break;

 

Thanks :)

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Posted

I usually do it like this...

 

<?php

print ("blah blah blah".$variable."blah blah blah");

?>

 

so.. to put in a variable you end the quote put the . then the variable, then another . then continue with your quotes...

 

so for your example it would be something along the lines of

 

<?php

$prod_quantity = tep_get_products_stock($products_id);

switch ($prod_quantity) {

case 0:

print "<a href="mailto:[email protected]?subject=Freight Quote Request - ".$product_model.""><font color=red>email</font></a> us for a quote";

break;

Posted

Paddy;

 

Thank you so much!

 

I had tried it that way with no result, but your post reinforced for me that it should work that way - turns out that I had to define the model as

$product_info_values['products_model']

since it doesn't actually appear anywhere as just

$products_model :oops:

 

Works a treat!

 

Thanks again :wink:

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Posted

hehe yeah, usually when nothing displays where you have a variable it's because the variable hasn't been created/given a value... kind of annoying that php let's you use variables that haven't been created instead of giving an error.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...