Hi all,
Hope you are well. I am sorry if similar questions have been asked and answered in the past.
I have location, club, and club_location tables. I am trying to register data into club_location table using the data from location and club. I think I need to use for loop to do that but I am unsure how to proceed.
Below is how the registration form looks.
<form name="add_item" method="post" action="programmes_location.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" />
</td>
</tr>
</table>
</form>
My tblKids_Club_Resort have three fields - id, club_id and location_id. Is there a way for me to register the club_ids of the checkboxs into separate lines in tblKids_Club_Resort table?
Many thanks,