Im trying to assign the value of a php variable to a hidden element. But cant get it to work
Here's what Ive tried so far
Attempt 1:
echo '<input type="hidden" maxlength="100" name="value" id="val" value= "${myOb->content}"/>';
Attempt 2:
echo '<input type="hidden" maxlength="100" name="value" id="val" value= "<?php echo $myOb->content"/>';
On both counts . I just get the hard coded value ie. ${myOb->content} or <?php echo $myOb->content in the html element rather than the server side variable. Any thoughts on what Im doing wrong?
echo "<?php echo 'foo' ?>"is going to print PHP code, not "foo". and even then, you're using the wrong type of quotes to allow embedding variables in text anyways.$myobj->whatever. the{}brackets should only be used on variables within strings, e.g.echo "{$foo}"