Hi,
is there any way how to populate a form with pred-defined values, based on SQL output ?
My piece of code is as follows:
....
while ($row = mysql_fetch_assoc($result)) {
echo "<tr><td>Address: ", $row['address'], "</td></tr><td>City: ", $row['city'], "</td></tr>\n";
}
mysql_close ($conn);
?>
</td>
</table>
<td align=left valign=top >
<h4 align=center> To modify your contact information, fill out from below </h4>
<form method="post" action="update_v_ad.php">
<input type="Hidden" name="send" value="true">
<table>
<TR>
<TD><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Address:</font></TD>
<TD><input type=text name="address" ></TD>
</TR>
How can I get a form where input has pred-defined value pulled from sql query, so in case user don`t want to change address, there is no need form him to type address again..
Many Thanks!
populate form fields from sql output
Moderator: General Moderators
Re: populate form fields from sql output
Just echo the value in the address field.
Code: Select all
<input type="text" name="address" value="<?php echo $row['address'];?>">
Re: populate form fields from sql output
It works, Thanks !