我是编程新手。您能帮我从 MySQL 获取数据到 PHP 列表/菜单吗?
<tr>
<td align="right">Owners Name</td>
<td>
<select name="owners" id="owners">
<?php
$owners = mysql_real_escape_string($_POST['owners']);
$sql = mysql_query("SELECT lld_Lname,lld_Fname FROM landlords ");
while ($row = mysql_fetch_array($sql))
{
?>
<option <?php echo $_POST['owners']==$row['owners'] ? 'selected' : ''?>><?php echo $row['owners'] ?></option>
<?php
}
?>
</select>
</td>
</tr>
运行上面的代码后,我得到这个错误:
注意 :undefined index:owners in c:\wamp\www\real_estate\admin\add_building.php online 41