Reputation: 175
I'm trying to GET all data from dynamic multidimensional form. Each column has different name and id like this :
$result2 = mysql_query("SELECT * FROM tempselect");
while($row = mysqli_fetch_row($result2))
{
for ($i = 0; $i < count($result2) ; $i++) {
echo "<tr>";
for ($j = 0; $j < 12 ; $j++) {
echo "<td><input type=\"text\" size=\"4\" name=\"" . $i++ ."[]\"id=\"" .$row[$j] ."\" value=" . $row[$j] . "></td>";
}
}
}
Code above works properly, each column got different name and id. the output is like this :
The purpose from this form is to edit data from database and use it for next process. Now i want to combine all data into 1 multidimensional array like this :
2 4 4 . . . 0
3 . . . . . 0
3 . . . . . 0
. . . . . . 0
. . . . . . 0
3 . . . . . 0
I tried using code below, but only the first column saved into $data :
for ($i=0; $i < count($_GET['0']); $i++) {
for ($j=0; $j < count($_GET['submit_edit']); $j++) {
$data =$_GET[$j];
}
}
Upvotes: 3
Views: 46
Reputation: 136
$data = array();
for ($i=0; $i < count($_GET['0']); $i++) {
for ($j=0; $j < count($_GET['submit_edit']); $j++) {
$data[] =$_GET[$j];
}
}
This is just as you are doing i see $data has to be $data[] . However I dont know what rest you are doing. If this solves the problem then good, if doesnt then please make the question more clear related to $_GET['submit_edit'] and other $_GET's
Upvotes: 1