Hi Guys
I have been trying to write a page in php that allows the user to select values from a database via dropdown boxes, and then to post these values back to the database.
I have most of the functionality working, but am having problems when using the gui to edit a record.
My issues are the dropdown boxes. I have all the previously used data available, as they were pulled from session variables, and I can assign these values back to the text fields on the form, but have been unable to work out how to give the dropdowns a default value.
I know the selected tag in html will work with a list of options, but I am not sure how to use this in my array driven ones.
The code is as follows:
<select name="project" size="1" id="project>
<?php
do {
?>
<option value = "<?php echo $row_Recordset2['Project_Label'?>"</option><?php echo $row_Recordset['Project_Label']?></option>
<?php
}while($row_Recordset2=mysql_fetch_assoc($Recordset2));
$rows = mysql_num_rows($Recordset2);
if ($rows>0){
mysql_data_seek($Recordset2, 0);
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
}
?>
</select>
what i need to know is how to get that to select a default value, specified by the variable $project (grabbed from the session variable by another script)
Any help greatly appreciated