Hi
As the title suggests my problem is that I'm trying to get some of the enumerated fields (e.g. Sex, Age range, etc) to link into my drop down boxes in my script. I also want to be able to update the specific selection for each record with the drop down box.
I have managed to get this populate and update idea working using text form fields but I'm having a real issue trying to figure out how to get it working for a drop down menus and combo boxes.
I'm assuming a while loop, looping through the options available and creating a new <option> each time.
I have seen code snippets that do this which I've been trying to use, but these snippets refer to an entire table, I just want to select the enum options from a specific column.
Below is the snippet I think I could use if only I could get the query correct.
<form method="get" action="view_urls.php">
<select name="type">
<option value="NULL">Choose a Category:</option>
';
// Retrieve and display the available categories.
$query = 'SELECT * FROM url_categories ORDER BY category ASC'; //POSSIBLE TO MAKE THIS QUERY SELECT ONLY THE ENUM OPTIONS????
$result = mysql_query ($query);
while ($row = mysql_fetch_array ($result, MYSQL_NUM)) {
echo "<option value=\"$row[0]\">$row[1]</option>
";
}
// Complete the form.
echo '</select>
<input type="submit" name="submit" value="Go!">
</form>
I've been racking my brains out trying to figure this out...
I'm pretty new to PHP and SQL and this is a little out of my grasp right now.
I appreciate all help.