Page 1 of 1

getting multiple values and outputting them in an option box

Posted: Thu Feb 16, 2006 12:09 pm
by a94060
hi

i have a table called 'homework' and inside i got"id,teacher,period,course_id"

i want to output the the teacher and course id as an option box so it will be like:


BOXHERE
teacher,course_id
teacher,course_id
teacher,course_id
teacher,course_id


Will it be able to be done something liek this?
i first start the option box(i will look into that)

Code: Select all

foreach($thing as $option) {
echo'<option>$option</option>';
}

Re: getting multiple values and outputting them in an option

Posted: Wed Feb 22, 2006 3:18 am
by hnawri
a94060 wrote:hi

i have a table called 'homework' and inside i got"id,teacher,period,course_id"

i want to output the the teacher and course id as an option box so it will be like:


BOXHERE
teacher,course_id
teacher,course_id
teacher,course_id
teacher,course_id


Will it be able to be done something liek this?
i first start the option box(i will look into that)

Code: Select all

foreach($thing as $option) {
echo'<option>$option</option>';
}
<?
$sql = "SELECT teacher,course_id FROM homeworks";
$result = mysql_query($sql);
?>

<select name='blabla'>

<?while($row = mysql_fetch_row($result) echo "<option value='blabla'>$row[0] - $row[1]</option>";?>

Posted: Wed Feb 22, 2006 12:05 pm
by a94060
that will work for a drop down bow right?