This routine did work, then I changed something (what ??) and now it does not. Am selecting arrays from MySQL db, generating a drop-down list and user will select a row which contains 2 data fields - garden number (grdnno) and garden name (grdnname). For presentation, an ' - ' is displayed between the 2 fields.
The db query works as does the creation of the drop-down list. But when a row is selected, I am not able to identify it. Once I am able to identify the selection, I will explode the array in order to specifically identify the garden number and name.
Thanks - the code follows:
<?PHP
// Process member's list of garden profiles.
?>
<html>
<form name="garden_selection" method="POST" action="">
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td>
<?PHP
// Start - Display List of Member's Gardens
$resultBuffer = array();
// Retrieve all values and place in arrays.
$i = 0;
While ($row = mysql_fetch_array($result))
$resultBuffer[$i++] = "$row[0] - $row[1]";
// Start the select widget
echo "\n<select name='selectgarden'>";
// Display "<Select Your Garden>"
echo "\n\t<option selected>Select Your Garden";
// Show database values as options
{
foreach ($resultBuffer as $result)
echo "\n\t<option>$result";
}
echo "\n</select>";
$garden_id_from_drop_down = 'Y';
// End - Display List of Gardens
?>
<input type=submit name="SelectGardenID" value="submit">
<input type=reset name="Reset" value="reset">
</td>
</tr>
</table>
</form>
<?PHP
if ($SelectGardenID == "submit"):
$selectgarden = $_POST['selectgarden'];
$grdnID=explode(' - ', $selectgarden);
$grdnno=$grdnID[0];
$grdnname=$grdnID[1];
endif;
?>
</html>