I got it to not show an error but it doesn't delete when a check box is selected, and then when you just click delete it still echo's Success.
Code:
<?php
include("include/config.php");
include("include/opendb.php");
if( isset($_POST['submit']) )
{
$error['2'] = true;
if( count($_POST['box']) < 1)
{
$error['0'] = ture;
$error['1'][] = "Please choose something to delete";
}
if( $error['0'] == false )
{
mysql_query("DELETE FROM `test` WHERE `news` = '$delete'") or die(mysql_error());
mysql_query("DELETE FROM `test` WHERE `shout` = '$delete'") or die(mysql_error());
}
$error['1'][] = "Successfully deleted news";
}
if( $error['2'] == true )
{
foreach( $error['1'] as $message )
{
echo "$message<br />\n";
}
}
$content = array();
$query = mysql_query("SELECT * FROM `test`");
while( $array = mysql_fetch_assoc($query) )
{
$content[] = " <td> <input type=\"checkbox\" name=\"box\" value=\"{$array['news']}\" /> </td>
<td> {$array['news']} </td>
<td><input type=\"checkbox\" name=\"box\" value=\"{$array['shout']}\" /></td>
<td> {$array['shout']} </td>\n";
}
echo " <form action=\"deletebeta.php\" method=\"post\">";
echo " <table>\n";
foreach( $content as $tds )
{
echo " \t<tr>
\t$tds
\t</tr>\n";
}
echo " </table>
<input type=\"submit\" name=\"submit\" value=\"delete\" />
</form>";
?>
Last edited by Aaron™; 08-08-2008 at 12:45 AM..
|