I need to insert specific rows of an HTML table into a PHP array using a checkbox. For some reason only the first column is going into the array. the code i wrote is:
if(isset($_GET["key"])) {
$user_key = $_GET["key"];
if ($stmt = $mysqli->prepare("SELECT sandwich.sname, description, size, price FROM sandwich JOIN menu on sandwich.sname = menu.sname WHERE description like ?")) {
$stmt->bind_param("s", $search_string);
$search_string= "%".$user_key."%";
$stmt->execute();
$stmt->bind_result($sname, $description, $size, $price);
// Printing results in HTML
echo "The menu for the given key word is.<br>";
echo "<table border = '1'>
";
while ($stmt->fetch()) {
echo "<tr>";
echo "<td>$sname</td><td>$description</td><td>$size</td><td>$price</td><td><input type='checkbox' name='order[]' value='$sname'|'$size'|'$price'></td>";
echo "</tr>
";
}
echo "</table>
";
$stmt->close();
$mysqli->close();
}
I nede all the sname, size and price values in the array order[] but only sname isgoing into it. Someone please suggest what is wrong with the code. I am totally new to PHP.