Hi all,
I'm trying to populate a select list from values in a table. I cannot get it to work, so I would appreciate any assistance in getting the values to be displayed. Here is my code:
<form name="addStudent" method="post">
Student: <select><?php
$sql="SELECT name FROM student";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
foreach($result as $row->$name)
{
?><option value="<?php echo $name; ?>"><?php echo $name; ?></option> <?php
}
?></select><br />
</form>
Cheers,