Hi,
I'm very new to php and have started my first web application:queasy: .
I'm designing a system where venues need to register, I have mostly completed the registration page but am struggling with one particular aspect.
The database consists of the tables:
venue(Where foreign key=AreaID)
area(AreaID, AreaName, AreaRegion)
When venues register they must select an AreaID. At the moment I have dynamically created a drop down box that is populated by querying the area table in mysql. It sorts the option by AreaName and the values correspond to the AreaID.
Whilst I was initially happy, I've realised that the sheer number of areas mean it will have to be sorted by AreaRegion. I think optgroup can be used to achieve this. The AreaRegion column is type enum('Scotland', 'Wales',....) with more regions to be added.
I've down a little research, but have ended up more confused than before! Any suggestions would be much appreciated. My code at the moment:
<p><b>Select Area:</b><select name="areaid">
<?php
$query1 = "SELECT AreaID, AreaName from area ORDER BY AreaName ASC";
$result1=@mysql_query($query1);
while ($row = @mysql_fetch_array($result1)) {
print '<option value="' . $row['AreaID'] . '">' . $row['AreaName'] . '</option>';
}
?>
</p>
</select>
Thanks in advance!