Ok i think i'm getting closer to what I need.. Here's the error msg i'm getting.
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'table WHERE id = Stef Longo' at line 1
Here is my code
<html>
<head>
</head>
<body>
<?php
// make connection
$con = mysql_connect("###", "###", "###");
if (!$con)
{
("\nCould connect to database.<br>Error: " . mysql_error());
}
mysql_select_db("site_eval",$con);
// sql query
$evals = mysql_query("SELECT * FROM site_eval ");
//or die ("\nCould not insert entry into database. <br>Error: " . mysql_error());
?>
<form method="post" action="delete.php">
<table border='1'>
<tr>
<th><font size="2"><input id='delete' type='submit' name='delete' value='Delete'/></font></th>
<th><font size="2">Time</font></th>
<th><font size="2">Name</th></font>
<th><font size="2">JobTitle</th></font>
<th><font size="2">WorkPhone</th></font>
<th><font size="2">CellPhone</th></font>
<th><font size="2">Email</th></font>
<th><font size="2">Company</th></font>
<th><font size="2">BusType</th></font>
<th><font size="2">Avg Bill</th></font>
<th><font size="2">Ownership</th></font>
<th><font size="2">Street</th></font>
<th><font size="2">City</th></font>
<th><font size="2">State</th></font>
<th><font size="2">Zip</th></font>
<th><font size="2">Comments</th></font>
</tr>
<?php
while($row = mysql_fetch_array($evals))
{
?>
<tr>
<td><input type="checkbox" name="checkbox[]" id="checkbox[]" value="<?php echo $row['Name']?>" /></td>
<td><font size="2"><?php echo $row['time']?></font></td>
<td><font size="2"><?php echo $row['Name']?></font></td>
<td><font size="2"><?php echo $row['JobTitle']?></font></td>
<td><font size="2"><?php echo $row['WorkPhone']?></font></td>
<td><font size="2"><?php echo $row['Email']?></font></td>
<td><font size="2"><?php echo $row['Company']?></font></td>
<td><font size="2"><?php echo $row['BusinessType']?></font></td>
<td><font size="2"><?php echo $row['MonthlyBill']?></font></td>
<td><font size="2"><?php echo $row['Ownership']?></font></td>
<td><font size="2"><?php echo $row['Street']?></font></td>
<td><font size="2"><?php echo $row['City']?></font></td>
<td><font size="2"><?php echo $row['State']?></font></td>
<td><font size="2"><?php echo $row['Zip']?></font></td>
<td><font size="2"><?php echo $row['Comments']?></font></td>
</tr>
<?php
}
?>
</table>
</form>
</body>
</html>
and code for delete.php
<html>
<head>
</head>
<body>
<?php
// make connection
$con = mysql_connect("###", "###", "###");
if (!$con)
{
("\nCould connect to database.<br>Error: " . mysql_error());
}
mysql_select_db("site_eval",$con);
// sql query
$evals = mysql_query("SELECT * FROM site_eval ");
//or die ("\nCould not insert entry into database. <br>Error: " . mysql_error());
if($_POST['delete']) // from button name="delete"
{
$checkbox = $_POST['checkbox']; //from name="checkbox[]"
$countCheck = count($_POST['checkbox']);
for($i=0;$i<$countCheck;$i++)
{
$del_id = $checkbox[$i];
$sql = "delete FROM table WHERE id = $del_id";
$result = mysql_query($sql, $con);
}
if($result)
{
echo "successful delete";
}
else
{
echo "Error: ".mysql_error();
}
}
?>
</body>
</html>
any help would be greatly appreciated.