Please point me in the right direction here Im trying to do the following:
- Multiple select boxes are generated for each eventid
- User choose who they think will win each event
- The name of each selectBox is the event id assigned to variable $id
- At end of while loop I want to extract the array $id value in For loop, however im getting error "undefined offset & invalid argument" on my for loop...
Here is my form
$i=0;//counter
while($row=mysql_fetch_array($result)){
$team1 = $row['team1'];
$team2 = $row['team2'];
$id[$i]= $row['event_id'];
echo'<h3>'.$team1.' VS '.$team2.'</h3>';
echo'<select name="'.$id[$i].'">';
echo'<option value="'.$row['team1'].'">'.$team1.'</option>';
echo'<option value="'.$row['team2'].'">'.$team2.'</option>';
echo'</select>';
$i++;
}//while
Here is my for loop giving error, I suspect problem is in the
$_POST['$id']
...
if(isset($_POST['submit'])){
foreach($_POST[$id] as $eventId => $winner){
echo'<h3>'.$eventId.'</h3>';
}//for loop
}//end isset
Any help will be greatly appreciated