The first page is as follows. Text is read in from multiple rows of a database. When each field is read in, a checkbox is created. When the check box is checked and the 'Delete Checked Entries' is clicked the information from the form is sent to the next page.
<?php
$user="";
$host="";
$password="";
$database="";
$connection=mysql_connect($host,$user,$password) or die ("could not connect to mysql.");
$db = mysql_select_db($database,$connection) or die ("could not connect to the database.");
$query = "select * from helloWorld";
$result = mysql_query($query) or die (mysql_error());
echo "<form action='deleteTest.php' method='post'>";
while ( $row = mysql_fetch_array($result,MYSQL_ASSOC))
{
extract($row);
echo "<input type='checkbox' name='$num'><b>$entry</b> <br>";
}
echo "<input type='submit' value='Delete Checked Entries'>";
echo "</form>";
?>
I would like the second page to be as follows. Which ever check box is checked, the corresponding entry in the database is deleted.
$query = "delete from helloWorld where num=$num";
$result = mysql_query($query) or die (mysql_error());
the entry field in the table is, of course, a text field. the num field in the table is an auto-incrimented field.