Putting the value of a PHP variable into a form control
Posted: Sat May 31, 2008 2:13 pm
Hi:
I am a newcomer to PHP. I am trying to put the value in a PHP variable into the value of a form control. The code I have tried is:
***** PLEASE USE THE CODE AND PHP TAGS *****
The code:
Anyone know a solution? 
I am a newcomer to PHP. I am trying to put the value in a PHP variable into the value of a form control. The code I have tried is:
***** PLEASE USE THE CODE AND PHP TAGS *****
Code: Select all
$row = mysql_fetch_row($result);
$str = $row[1];
$str .= ", ";
$str .= $row[2];
echo '<form action="testSendQueryData.php" method="get">';
echo '<br>';
echo '<input type="text" name="iName" value = $str>';
echo '<input type="submit">';Code: Select all
"value = $str"
does not work. The form sends the string "$str". I have also tried:
echo '<input type="text" name="iName" value = value = <?php echo "$str;" ?>>