Dear all,
Hope you are well.
I have just created a page which list a resort name and all the fitness clubs that are available in that resort.
I would like to register the clubs that are being ticked into a table as separate rows. The table name is called tbl_Club_Resort and it has three fields (id, location_id, club_id).
I know one would need to use loop but not sure where to start. I wonder someone can help please.
Many thanks.
Below is my current code:
---------
<form name="add_item" method="post" action="location_kids_programmes.php" onsubmit="return checkInput(this);">
<div id="error" class="hide"></div>
<table width="100%" border="0" cellpadding="5" cellspacing="0">
<tr>
<td>Resort</td>
<td>
<select name="resort" size="1" class="textInput">
<option value="-1" selected>Choose one...</option>
<?php
$sql = "SELECT id 'location_id', name FROM Location WHERE enabled = 1 ORDER BY name";
$result = mysql_query($sql) or die(mysql_error());
while ($row=mysql_fetch_assoc($result))
{
?>
<option value="<?php echo $row['location_id']; ?>"><?php echo $row['name']; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<?php
$sql = "SELECT id, club_name FROM tblKids_Club WHERE active = 1 ORDER BY club_name";
$result = mysql_query($sql) or die(mysql_error());
while ($row=mysql_fetch_assoc($result))
{
?>
<tr>
<td><?php echo $row['club_name']; ?></td>
<td><input type="checkbox" name="<?php echo $row['club_id'];?>"></td>
</tr>
<?php
}
?>
<tr>
<td></td>
<td style="text-align: right;">
<input type="hidden" name="action" value="ins" />
<input type="submit" value="Add" />
<input type="button" value="Back" onclick="window.location.href='location_kids_programmes.php'" />
</td>
</tr>
</table>
</form>
-----
Thanks again.