Hi,
A bit of background to help set the seen....
I'm building an online tool for use with racing at our sailing club. On any given day there can be between 1 and X number of races. Those wishing to take part in a race have to sign on to let the race team know they are going on the water. This is where the fun begins.
The process....
The days race officer pulls the details for the days races from the db and ensures they are all up to date. They can then choose whether or not they want to allow racers to sign on for all the days races or just one or two. Similarly, the racers can choose if they want to sign on for one or all of the scheduled races on that day.
Here's the problem....
There are check boxes on the form which are created dynamically depending on which races are opened to join. here is the form....
<form action="" method="post" name="form1" id="form1">
<table align="center"><tr>
<td> Sign on for <?php echo $row_racestoday['seriesname']; ?>, </td>
<td align="left"> <?php do { ?>
<?php echo $row_racestoday['raceynumber']; ?><input name="whichrace[<?php echo $row_racestoday['raceunique']; ?>]" type="checkbox" value="<?php echo $row_racestoday['raceunique']; ?>"/>
<?php } while ($row_racestoday = mysql_fetch_assoc($racestoday)); ?></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right" >Helm:</td>
<td colspan="<?php echo $_GET['races'];?>" ><input type="text" name="helm"></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Crew:</td>
<td colspan="<?php echo $_GET['races'];?>"><input type="text" name="crew"></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Boat:</td>
<td colspan="<?php echo $_GET['races'];?>"><input type="text" name="boat"></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Sail Number:</td>
<td colspan="<?php echo $_GET['races'];?>"><input type="text" name="sailnumber" value="" size="20" /></td></tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td colspan="<?php echo $_GET['races'];?>"><input type="submit" value="Sign On" /></td>
</tr>
</table>
<input name="racecrewid" type="hidden" value="<?php echo $_SESSION['raceteam']; ?>" />
</form>
Ultimately, what I'm trying to do is get the data posted with the names, type of boat, sail number etc into the competitors table on the database. Having failed to get that to work so far, I'm just trying to loop through the form data and echo it for each of the races the competiors select (working on the principle that once I can get the info shown for each race, the input bit is quite easy!!).
This is what I'm trying at the moment...
<?php
$raceid = $_POST['whichrace'];
$steerer = $_POST['helm'];
$swimmer = $_POST['crew'];
$boatywoaty = $_POST['boat'];
$knowtheboat = $_POST['sailnumber'];
$todaysteam = $_POST['racecrewid'];
foreach ($_POST['whichrace'] as $pleaseplease);{
echo $pleaseplease."<br/>";
echo $steerer. "<br/>";
echo $swimmer. "<br/>";
echo $boatywoaty. "<br/>";
echo $knowtheboat. "<br/>";
echo $todaysteam. "<br/>";
}
?>
I've also tried for loops and do - while loops but just can't get it to work.
Any ideas???
Many thanks
Dave.....