I am making a dynamic events listing for a club promoter, for each event there could be a different number of dj's. To acccomodate this i have one table in my DB for the common attributes, i.e. venue name, price, date etc. and i have created a seperate table to hold the event_id(primary key from the main events table) and the dj_name. I have an initial form that takes the common attributes(price etc.) and also asks how many dj's are playing. I pass this number to a for loop which creates the requisite number of input boxes for the dj_names in this way:
echo '
<form name="djForm" action="addEvent.php?mode=checkDJ" method="POST">
<table width="80%" align="center" cellpadding="2" cellspacing="2">
';
$t = $dj_no;
for($i=0; $i<=$t; $i++)
{
echo '
<tr>
<td align="right" class="basic">DJ Number '.$i.'</td>
<td align="left">
<input type="text" name="djnum'.$i.'" id="djnum'.$i.'">
</td>
</tr>
';
}
echo '
<tr>
<td> </td>
<td align="left"><input type="submit" name="submit" value="submit"
</tr>
</table>
</form>
usually when i deal with forms i pass the vars to a further section of the script where i validate the data using a function. The problem is though how i can actually retrive the individual posted vars (which would normally just be $var = $_POST['var'])sent by djnum'.$i.' for each input to use in my validator function:
field_validator("price", $_POST["price"], "alphanumeric_space", 1, 255);
and for that matter then be able to insert them into my databse.
i would really appreciate any advice. Thanks.