This is my first time asking a question on stackoverflow and this question has me stumped. I'm also a beginner at php and html.
<body>
<div class="topnav" id="navbar">
<a href ="user_main_page.php"><img style="max-width:32px; margin-top:-3px;"
src="/image/logo.jpg"></a1>
<a href="user_main_page.php">Home</a>
<a class="active" href="user_ordernow.php">Order Now</a>
<a href='user_menu.php'>Our Menu</a>
<a href="user_about.php">Who are we?</a>
<a href="user_contact.php">Contact Us</a>
<a style = "float:right" href="../login_page.php">Log Out</a>
</div>
<div class="tab">
<button class="tablinks" onclick="openTab(event, 'Breakfast')"
id="defaultOpen">Breakfast Menu</button>
<button class="tablinks" onclick="openTab(event, 'Snacks')">Snacks</button>
<button class="tablinks" onclick="openTab(event, 'Drinks')">Drinks</button>
<button class="tablinks" onclick="openTab(event, 'Main')">Main
Button</button>
<button class="tablinks" onclick="openTab(event,
'Checkout')">Checkout</button>
</div>
<div id="Breakfast" class="tabcontent">
<?php
/*declare parameters for $conn*/
$username="root";
$password="";
$database="login";
$con = mysql_connect("localhost", $username, $password);
$selectdb = mysql_select_db("login",$con);
$result = mysql_query("SELECT * FROM menu where category='1'")
or die(mysql_error());
echo "<table border='0' cellpadding='10'>";
echo "<tr> <th>Order</th> <th>ID</th> <th>Product</th> <th>Price ($)</th></tr>";
// loop through results of database query, displaying them in the table
while($row = mysql_fetch_array( $result )) {
echo "<tr>"; // echo out the contents of each row into a table
echo '<td><input type="checkbox" value="" name="id[]" />' . '</td>'; />' . '</td>';
echo '<td>' . $row['id'] . '</td>';
echo '<td>' . $row['name'] . '</td>';
echo '<td>' . $row['price'] . '</td>';
echo "</tr>";
}
echo "</table>";
?>
</div>
<div id="Snacks" class="tabcontent">
<h3>snacks</h3>
<p></p>
</div>
<div id="Drinks" class="tabcontent">
<h3>Drinks</h3>
<p></p>
</div>
<div id="Main" class="tabcontent">
<h3>Main</h3>
<p></p>
</div>
<div id="Checkout" class="tabcontent">
<h3>Checkout</h3>
<p></p>
</div>
It's connected to a mysql database Login and table menu. In php section of the code I access the database and display the database in a table. The problem that I have is retrieving the ticked checkboxes after I press a submit button at the end. How can I, after pressing a submit button retrieve which checkboxes are ticked and store that information to another mysql database? The current layout is such.
Thankyou in advance!!