I am trying to echo a value from a list menu that has been chosen by the user in a previous session i.e i want to prepopulate the list menu
here is what i have so far which works a treat with other input objects
<?php
include("include/session.php");
include("connect.php");
// query
$sql = "SELECT * FROM qualityuser WHERE username = '".$username."'";
$result = mysql_query($sql);
// if we have rows, fetch them
if(mysql_num_rows($result) > 0) {
$row = mysql_fetch_array($result);
} else {
$row = array('time'=>'','demand'=>'','external_support'=>'','training'=>'','complexity'=>'','depth'=>'','partuse'=>''
,'cost'=>'' ,'orgwhole'=>'','external_validated'=>'');
}
?>
then the menu itself:
<select name="time">
<?php
$values = array('Flexible', '12 months +', '0-12 months');
foreach($values as $val)
{
printf("<option%s>$val</option>\n", ($val == $row['time']) ? "selected" : "");
}
?>
</select>
many thanks in advance