Mo Star Mo Star - 1 year ago 53
PHP Question

echo html in php with input value as php variable

I am very new to PHP and can't seem to get the following to work. Any help would be appreciated. I am trying to echo a HTML input field and set the value to a variable.

echo "<input type='hidden' name='item_name' value='<?php echo $one.$two; ?>'>" ;

What's wrong with this? When I inspect it on the page it does not show the value of the variable.


You must do like this

echo "<input type='hidden' name='item_name' value='".$one.$two."'>" ;

Strings and variables are connected with .