<select name="select">
</select>
Run Code Online (Sandbox Code Playgroud)
我想用数据库中的值填充上面的标记.
我已经编写了PHP代码.
while($row=mysql_fetch_array($result))
{
}
Run Code Online (Sandbox Code Playgroud)
$ row正在获取正确的值..如何将其添加到 <select>
请帮忙......我是编程新手
我需要sql数据库填充表单输入的值.我的代码适用于所有文本和textarea输入,但我无法弄清楚如何将数据库值分配给下拉列表,例如.'房产类型'如下.它围绕着"选择选项"来表示数据库中保存的值.
这是我的代码:
$result = $db->sql_query("SELECT * FROM ".$prefix."_users WHERE userid='$userid'");
$row = $db->sql_fetchrow($result);
echo "<center><font class=\"title\">"._CHANGE_MY_INFORMATION."</font></center><br>\n";
echo "<center>".All." ".fields." ".must." ".be." ".filled."
<form name=\"EditMyInfoForm\" method=\"POST\" action=\"users.php\" enctype=\"multipart/form-data\">
<table align=\"center\" border=\"0\" width=\"720\" id=\"table1\" cellpadding=\"2\" bordercolor=\"#C0C0C0\">
<tr>
<td align=\"right\">".Telephone." :</td>
<td>
<input type=\"text\" name=\"telephone\" size=\"27\" value=\"$row[telephone]\"> Inc. dialing codes
</td>
</tr>
<tr>
<td align=\"right\">".Type." ".of." ".property." ".required." :</td>
<td>Select from list:
<select name=\"req_type\" value=\"$row[req_type]\">
<option>House</option>
<option>Bungalow</option>
<option>Flat/Apartment</option>
<option>Studio</option>
<option>Villa</option>
<option>Any</option>
</select>
</td>
</tr>
....
Run Code Online (Sandbox Code Playgroud)