View Full Version : Listbox Select Question

03-13-2007, 05:01 AM
Below is the code i am using to populate a listbox.

echo('<select name"course">');
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
echo "<option>".$row['course_name']."</option>";
echo('</select><br /><input type="submit" value="go" /></form>');

The table scheme is:
course_id int not null auto_increment
course_name char(150) not null

Is there a way with php to reference the course_id?

I can do
$course_name = $_POST['course'] just fine but cant figure out howto pull course_id out.

03-13-2007, 05:31 AM
opps.. figured it out..

<option value="'.$row['course_id']'">