Answer fo the post (Trouble with $_POST [duplicate])
I don't know if I understand your concern.
I think you are trying to create a quiz. And so the user must validate several attempts. your problem is that you can not accumulate the different answers following a table. so here is a solution.
<?php
$good_answers = array(
"easy1" => array("4","3","5","2","6","9","7","8","1" ),
"easy2" => array("6","8","2","5","7","1","4","9","3" ),
"easy3" => array("1","9","7","8","3","4","5","6","2" ),
"easy4" => array("8","2","6","1","9","5","3","4","7" ),
"easy5" => array("3","7","4","6","8","2","9","1","5" ),
"easy6" => array("9","5","1","7","4","3","6","2","8" ),
"easy7" => array("5","1","9","3","2","6","8","7","4" ),
"easy8" => array("2","4","8","9","5","7","1","3","6" ),
"easy9" => array("7","6","3","4","1","8","2","5","9" )
);
if(isset($_POST['row'])){
$easy = false;
$client_responses = $_POST['row']; // EX: [" "," "," " ,"2","6"," " ,"7"," " ,"1"]
$old = json_decode($_POST['old']);
$old[] = $client_responses;
// Or make array_push($old,$client_responses); if you prefere
foreach ($good_answers as $easy => $responses) {
if($client_responses === $responses){
$easy = $responses;
break;
}
}
// generating table for HTML of client responses
echo '<table>';
// saving old responses
echo '<input type="hidden" value="'. json_encode($old) .'" name="old">';
foreach ($old as $number => $row) {
echo '<tr id="row'. $number .'">';
for ($i=0; $i < count($row); $i++) {
echo '<td class="cellTop">';
echo '<input type="text" maxlength="1" name="row" value="'. $row[$i].'"/>';
echo '</td>';
}
echo '</tr>';
}
echo '</table>';
}
nameattribute, and that attribute will be needed to pass information to your PHP script to be used in MySQL.