Can anyone please assist how to retrieve data for dropdown menu from database. I have dropdown menu in mysettings.php of login script v2. The array i am using retrieves the all contents from the database for selected dropdown menu but it does not retrieve the specific saved data selection (dropdown menu) that user registered (register.php) in mysettings.php
Do I use the same mysql_query (rs_mysettings) for the dropdown menu or do I write a new code to query the database for the dropdown menu? If so can anyone please provide solution (query) for the dropdown menu. I am new to php and do not know how to do this.
Basically I want to pull saved data from database in mysettings.php that user saved from selection in dropdown menu at the time they registered their details.
My code for the dropdown menu in register.php
<table width="100%" border="0" cellspacing="0" cellpadding="5" class="main">
<tr>
<td width="147">Acc Category<span class="required">*</span><br />
<select name="acc_category" id="acc_category" class="required">
<option value="" selected></option>
<option value="Bed & Breakfast">Bed & Breakfast</option>
<option value="Guest House">Guest House</option>
<option value="Selfcatering">Selfcatering</option>
<option value="Hotel">Hotel</option>
<option value="Lodge">Lodge</option>
<option value="Backpacker">Backpacker</option>
</select></td>
</tr>
</table>
------------------------------------------------------------------------------
I am using an array as provided by pbu to populate the selectboxes in form (mysettings.php) like so:
<table width="100%" border="0" cellspacing="0" cellpadding="5" class="main">
<tr>
<td width="147">Acc Category<span class="required">*</span><br />
<select name="acc_category" id="acc_category" class="required">
<?php
//Array of accommodation categories for select box
$Categories = array("Bed & Breakfast","Guest House", "Selfcatering", "Hotel","Lodge","Backpacker" );
$dbacc_category = "Guest House"; //Stored in database
foreach ($Categories as $acc_category)
{
if($acc_category == $dbacc_category) {
echo "<option value=\"$acc_category\"SELECTED>$acc_category</option>";
}
else
{
echo "<option value=\"$acc_category\">$acc_category</option>";
}
}
?>
</select></td>
</tr>
</table>
Any help is apprecieted.