Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

printing cookie values in comment box


sunfire616

Recommended Posts

Posted

I'm new to PHP, but pretty good in ASP. I am trying to insert a cookie value into the comment box on the checkout page. I'm trying to edit the includes>functions>html_outputs.php file. Here's my code:

 

// Output a form textarea field

function tep_draw_textarea_field($name, $wrap, $width, $height, $text ='echo $_COOKIE["name"]', $parameters = '', $reinsert_value = true) {

$field = '<textarea name="' . tep_output_string($name) . '" wrap="' . tep_output_string($wrap) . '" cols="' . tep_output_string($width) . '" rows="' . tep_output_string($height) . '"';

 

if (tep_not_null($parameters)) $field .= ' ' . $parameters;

 

$field .= '>';

 

if ( (isset($GLOBALS[$name])) && ($reinsert_value == true) ) {

$field .= tep_output_string_protected(stripslashes($GLOBALS[$name]));

 

} elseif (tep_not_null($text)) {

$field .= tep_output_string_protected($text);

 

}

 

$field .='</textarea>';

 

return $field;

}

 

////

 

you can see sorta what i'm aiming at. I want the text box to be filled out with the cookie information. I keep getting unexpected t string errors. Im not sure what else to try and do to fix this. Any help will be greatly appreciated.

 

Thank you, Billy

Posted
I'm new to PHP, but pretty good in ASP. I am trying to insert a cookie value into the comment box on the checkout page. I'm trying to edit the includes>functions>html_outputs.php file. Here's my code:

 

// Output a form textarea field

function tep_draw_textarea_field($name, $wrap, $width, $height, $text ='echo $_COOKIE["name"]', $parameters = '', $reinsert_value = true) {

$field = '<textarea name="' . tep_output_string($name) . '" wrap="' . tep_output_string($wrap) . '" cols="' . tep_output_string($width) . '" rows="' . tep_output_string($height) . '"';

 

if (tep_not_null($parameters)) $field .= ' ' . $parameters;

 

$field .= '>';

 

if ( (isset($GLOBALS[$name])) && ($reinsert_value == true) ) {

$field .= tep_output_string_protected(stripslashes($GLOBALS[$name]));

 

} elseif (tep_not_null($text)) {

$field .= tep_output_string_protected($text);

 

}

 

$field .='</textarea>';

 

return $field;

}

 

////

 

you can see sorta what i'm aiming at. I want the text box to be filled out with the cookie information. I keep getting unexpected t string errors. Im not sure what else to try and do to fix this. Any help will be greatly appreciated.

 

Thank you, Billy

 

well, you do not change the function header but pass $_COOKIE['name'] to the $text parameter of the function.

Treasurer MFC

Posted
sorry, but I'm not understanding it. I tried $text =$_COOKIE['name']' but still got an error.

well, I do not know asp but I assume it also has functions and those functions you do not change but you rather pass different values to it's parameters. Same here, you leave the function declaration alone and there where you want the text box to appear (contact us I presume) you call the function and pass the appropriate info to it.

 

as in:

 

echo tep_draw_textarea_field('hello', true, 10, 15, $_COOKIE['name']);

Treasurer MFC

Posted
well, I do not know asp but I assume it also has functions and those functions you do not change but you rather pass different values to it's parameters. Same here, you leave the function declaration alone and there where you want the text box to appear (contact us I presume) you call the function and pass the appropriate info to it.

 

as in:

 

echo tep_draw_textarea_field('hello', true, 10, 15, $_COOKIE['name']);

 

 

thanks, its working now. i was trying something like that yesterday, but kept getting errors so i moved on. Thank youl

Archived

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

×
×
  • Create New...