$i=0;
while(isset($_POST['names'][$i])){
$names[] = $_POST['names'][$i];
$i++;
}
$i=0;
foreach($names as $name_current){
echo $names[$i];
echo $name_current;
$query = mysql_query("insert into names values ('','', '$names[$i]', '', '', '')");
$i++;
if(!$query){
echo "Database Error - 8";
exit;
}else{
echo "Names added successfully!";
}
}
the print_r() for the POST array is as follows,
Array
(
[names] => Array
(
[0] => 1
[1] => 2
[2] => 3
)
)
for some reason the query only works on the first iteration, the loop works fine without the query going through the array, just the query will only deposit the value of $_POST[names][0] into the database on the first query. Very confused.