Shaun, This: $values[] = $value; Does this: $values[] = array('Scheduling' => '44'); Therefore, it must be accessed like this: $values[$i]['Scheduling'] // gives '44' But not this: $values[$i][0] // index doesn't exist. Cheers, David Grant Shaun wrote: > Hi, > > I am trying to create a form on my page. The idea is that for each project > people can select whether they are allocated for scheduling, non_scheduling > or both. Here is an example of my form: > > <tr> > <td><input name="project[44][Scheduling]" type="checkbox" > value="44"></td> > <td><input name="project[44][Non_Scheduling]" type="checkbox" > value="44"><td> > <td>Project 1</td> > </tr> > <tr> > <td><input name="project[25][Scheduling]" type="checkbox" value="25"><td> > <td><input name="project[25][Non_Scheduling]" type="checkbox" > value="25"></td> > <td>Project 2</td> > </tr> > > I am trying to access the arrays in the HTML as follows: > > if (is_array($_POST['project'])){ > $fields=''; > $values=''; > foreach ($_POST['project'] as $project_id => $value) { > $fields[] = $project_id; > $values[] = $value; > } > $i = 0; > $num_elements = count($fields); > while($i < $num_elements){ > if(($values[$i]) != 0){ > echo '<br />$i = '.$i.'<br />'; > print_r($fields); > $query = ("INSERT INTO Allocations ( > User_ID, > Project_ID, > Scheduling, > Non_Scheduling > ) VALUES ( > '".$user_id."', > '".$fields[$i]."', > '".$fields[$i][0]."', > '".$fields[$i][1]."', > )"); > echo $query.'<br />'; > } > $i++; > } > } > > However I can't access the 'Scheduling / 'Non_Scheduling' part. Can anyone > see where I am going wrong here? > > Thanks for your advice > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php