HI
i am having bit of trouble with i small bit of code see the select box works fine till i want it to select option it pulls from data base
so i have a query that make
$classname = 1C
the drop box is populated from another table
0c 1c 2c 3c 4c
what i want the code to do is to have 1C selected or what ever value is assign to variable $classname
hope this makes sense
Does not work
[php]<?php
$query=mysql_query(“SELECT Class FROM Class”);
while ($fetch=mysql_fetch_assoc($query)) {
echo ‘<option value="’.$fetch[‘Class’].’";
if($fetch[‘Class’] == $classname){echo(“selected”);}
echo >’.$fetch[‘Class’].’’;
}
?>[/php]
Works but always selects first option
[php]<?php
$query=mysql_query(“SELECT Class FROM Class”);
while ($fetch=mysql_fetch_assoc($query)) {
echo ‘’.$fetch[‘Class’].’’;
}
?>[/php]