I have a table that dynamical displays info with checkboxes to submit. The problem is that when passing the checkboxed variables via submit form the form sends all of the data displayed in the page and not the checkboxed variables.
I'm am new to PHP and need some help with this code.
My table lookslike this
Error page where sea draft saved Hello,ts selected are supposed to displayed
Code that displays the avaible option with checkboxes to select
echo "<form method='GET' action='Orders.php'>";
$A=0;
$seating[$A]=array();
foreach($result as $row){
echo "<tr><td>".$row['Zone']."</td>
<td>".$row['RowNumber']."</td>";
$seat=$row['RowNumber'];
$seating[$A]=$seat;
echo"<td><input type='checkbox' name='Seats[]' value='1'></td>";
$A=$A+1;
}
//var_dump($seating);
echo "</table>";
echo "<br><button type='submit'>Submit</button>";
echo "</form>";
$_SESSION['Seats[]']=$seating;
}
Code from the page displaying the selected seats
function showSelection(){
$conn=connect();
$sql0="SELECT * FROM Production, Zone, Seat;";
$handle = $conn->prepare($sql0);
$handle->execute();
$conn=null;
$result=$handle->fetchAll();
echo "<center><table></center>
<tr>
<th>Seats</th>;
</tr>";
$x=0;
$testarray=array();
$testarray=$_SESSION['Seats[]'];
echo '<pre>'; print_r($testarray); echo '</pre>';
var_dump($_SESSION['Seats[]']);
//var_dump($size);
}
showSelection();
Aucun commentaire:
Enregistrer un commentaire