sorry to bump, but I relly need help with this.
Here is the form.
PHP Code:
<?php
include ("../template.php");
$connection = mysql_connect($host, $user, $password)
or die ("Couldn't connect to server.");
$db = mysql_select_db($database, $connection)
or die ("Couldn't select database.");
$sql = "SELECT `name`,`content`,`id`,`date`, `approve` FROM `shoutbox` WHERE `approve` ='n' ORDER BY `date` DESC";
$result = mysql_query($sql)
or die ("Couldnt execute query");
echo "<table width=\"100%\" border=\"0\" class=\"style4\"><tr>";
while ($row = mysql_fetch_array($result)) {
$name=$row['name'];
$id=$row['id'];
$content=$row['content'];
echo "<td width=\"85%\">$name</td>";
echo "<td width=\"15%\">$id <input type=\"checkbox\" name=\"checkbox\" value=\"true\"></td></tr><tr>";
echo "<td colspan=\"2\">$content<br><br></td></tr>";
}
echo"</table></p>";
?>
And here is the place its running through. It doesn't give any erors, but nothing happens?
PHP Code:
<?php session_start();
/* Program: approve_post.php
Descrip: This allows admin to approve posts before they go public.
*/
include ("../../../template.php");
$connection = mysql_connect($host,$user,$password)
or die ("Couldnt connect to server");
$db = mysql_select_db($database, $connection)
or die ("Couldnt select database");
foreach($_POST as $key => $value){
if ($id){
$sql = "UPDATE shoutbox SET approve='y' WHERE id='$id'";
mysql_query($sql)
or die("error");
exit();
} //ends if statement
else if ($id== "false"){
$sql = "DELETE * FROM shoutbox WHERE id='$id'";
mysql_query($sql)
or die ("error 2");
exit();
} //ends else
} //ends for each
?>
Bookmarks