DJMaze,
I have come up with the following code, that displays each record with it's own check box. Though how do I assign the "Numeric Array Store" value of each record to each check box, so when the delete button is clicked, the code knows which record in the $records array to
NOT copy into the $temp array?
Upon a record being selected and the delete button being clicked, how do I copy all but the selected records to a $temp array, from the $records array?
Code:
<?php
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("WB", $con);
$result = mysql_query("SELECT * FROM Birds");
if(mysql_error() != 0 || mysql_num_rows($result) == 0)
{
die("No database, or no data");
}
$records = array();
$temp = array();
while($row = mysql_fetch_object($result))
{
array_push($records, $row);
}
$i = 0;
foreach( $records as $k )
{
echo "$k->Name";
echo "$k->Species";
echo "$k->Sex";
echo "<input type='checkbox' name='remove[" .$i. "]' value=" .$i. " />\n";
$i++;
}
echo "<input type='submit' value='Delete' />\n";
?>
Many Thanks,