Hey,
I have a list of store names displayed in the script below. I am trying to delete the whole store row, by selecting the store and running a delete query. I am having trouble passing the store id to the $store_id variable through a checkbox. I am want to select a store via checkbox, and pass the ID to the $store_id using the POST super global. Does anyone have any suggestions. Below is my script.
<?php require_once("include/database_connection.php"); global $connection; ?> <?php if(isset($_POST['submit'])) { $store_id = ""; // How do I pass the store_id to the $store_id variable by selecting the store below //$delete_query = "DELETE FROM stores WHERE store_id = {$store_id} "; echo $store_id; } ?> <form action="delete_stores.php" method="post"> <?php $count=1; $get_all_stores = "SELECT * FROM stores "; $query = mysql_query($get_all_stores, $connection); while($display_store = mysql_fetch_array($query)) { echo "<input type=\"checkbox\" value=\"{$display_store['store_id']}\">" . $count . " " . $display_store['store] . "</input>" ."<br>"; $count++;} ?> <input type="submit" name="delete" value="delete"> </form>