Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP Form

Status
Not open for further replies.

dagoat10

Programmer
Jun 3, 2010
74
US
I have gotten to the point where i get data from mysql database, but when i try to put it in a form it does not work saying parse error expected T_VARIABLE, T_STRING.

here is the code:
echo "<form action='test2.php' method='post'>";
while ($row = mysql_fetch_array($result))
{
echo "<input type=\"text\" Value=\"$row["field2"]\" >";

}

echo "</form>";

what are i missing from it, to get default values in the form.
 
> echo "<input type=\"text\" Value=\"$row["field2"]\" >";
[tt] echo "<input type=\"text\" [red]v[/red]alue=\"[red]{[/red]$row[[red]'[/red]field2[red]'[/red]][red]}[/red]\">";[/tt]
or simply this, no more "manner":
[tt]echo "<input type=\"text\" [red]v[/red]alue=\"[red]".[/red]$row["field2"][red]."[/red]\">";[/tt]
 
or just remove the inner quotation marks from the array key
or use heredoc

Code:
echo "<input type=\"text\" value=\"$row[field2]\">";
// or
echo <<<HTML
<input type="text" value="{$row['field2']}" />
HTML;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top