Basically I have a table with records in that are automatically pulled from the database.I now need to make the delete button delete the records that are selected with the checkbox. I have added a simple form and placed the checkbox in the last column. The code is below. Thanks in advance
<html>
<head>
</head>
<body>
<?php
session_start();
include("dbconnect.inc");
$sql = "select * from student";
$result = mysql_query($sql,$conn);
echo "<form method=\"post\" action=\"<?php echo $PHP_SELF;?>\">";
echo "<table border='1'>";
echo "<tr><th colspan='11' align='center'>List of Students</th></tr>";
echo "<tr><th>Student ID</th><th>Password</th><th>Date of Birth</th><th>First Name</th>";
echo "<th>Last Name</th><th>House</th><th>Town</th><th>County</th><th>Country</th><th>Post Code</th><th>Select</th></tr>";
while($row = mysql_fetch_array($result)) {
echo "<tr><td> $row[studentid] </td>";
echo "<td> $row[password] </td>";
echo "<td> $row[dob] </td>";
echo "<td> $row[firstname] </td>";
echo "<td> $row[lastname] </td>";
echo "<td> $row[house] </td>";
echo "<td> $row[town] </td>";
echo "<td> $row[county] </td>";
echo "<td> $row[country] </td>";
echo "<td> $row[postcode] </td>";
echo "<td><input type=\"checkbox\" name=\"form1\" value=\"yes\" /></td>";
echo "</tr>";
}
echo "</table>";
echo "<input type=submit value=\"Delete\">";
echo "</form>";
?>
<br/><br/>
<a href="authenticate.php">Menu Page</a>
</body>
</html>
<html>
<head>
</head>
<body>
<?php
session_start();
include("dbconnect.inc");
$sql = "select * from student";
$result = mysql_query($sql,$conn);
echo "<form method=\"post\" action=\"<?php echo $PHP_SELF;?>\">";
echo "<table border='1'>";
echo "<tr><th colspan='11' align='center'>List of Students</th></tr>";
echo "<tr><th>Student ID</th><th>Password</th><th>Date of Birth</th><th>First Name</th>";
echo "<th>Last Name</th><th>House</th><th>Town</th><th>County</th><th>Country</th><th>Post Code</th><th>Select</th></tr>";
while($row = mysql_fetch_array($result)) {
echo "<tr><td> $row[studentid] </td>";
echo "<td> $row[password] </td>";
echo "<td> $row[dob] </td>";
echo "<td> $row[firstname] </td>";
echo "<td> $row[lastname] </td>";
echo "<td> $row[house] </td>";
echo "<td> $row[town] </td>";
echo "<td> $row[county] </td>";
echo "<td> $row[country] </td>";
echo "<td> $row[postcode] </td>";
echo "<td><input type=\"checkbox\" name=\"form1\" value=\"yes\" /></td>";
echo "</tr>";
}
echo "</table>";
echo "<input type=submit value=\"Delete\">";
echo "</form>";
?>
<br/><br/>
<a href="authenticate.php">Menu Page</a>
</body>
</html>