The follow code works when I use the GET method in the form, but not when I use POST.


If anyone as any ideas I would appreciate it.
Thanks.
jdwalke

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>E.A.C.H: Edit Rules</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
</head>
<body>

<?php

include 'dbeach.inc.php';
include 'banner.inc.php';
echo '<h1>Rules Administration</h1>';
$ruletext = $_REQUEST['ruletext'];
if (isset($ruletext)):
//news details have been updated
$ruleid = $_REQUEST['ruleid'];
$ruletext = $_REQUEST['ruletext'];

//$newstext = $_REQUEST['newstext'];
//$expiredate=$_POST['expire_date'];
//$steeringmembid=$_POST['steeringmembid'];

if($ruleid < 1){
$sql="INSERT INTO rules ";
}else{
$sql="UPDATE rules ";
}

$sql=$sql . "SET rules_text='$ruletext'";

if($ruleid > 0){
$sql=$sql . "WHERE rule_id='$ruleid';";
}

if (@mysql_query($sql)) {
echo '<p>Rule';
if($ruleid > 0){
echo " updated";
}else{
echo " added.";
}
echo '</p>';
} else {
echo '<p>Error updating rule: ' .
mysql_error() . '</p>';
} //end if
?>


<?php
else: //allow user to edit or delete
$mode = $_REQUEST['mode'];
$ruleid=$_REQUEST['ruleid'];

if ($mode == "delete" && $ruleid > 0):
$sql="DELETE from rules WHERE rule_id='$ruleid';";

if (@mysql_query($sql)) {
echo '<p>Rule deleted</p>';
} else {
echo '<p>Error deleting rule: ' .
mysql_error() . '</p>';
} //end if

?>
<?php else: //edit

$rules=@mysql_query("SELECT rules_text FROM rules WHERE
rule_id='$ruleid';");

if (!$rules) {
echo $sql;
exit('<p>Error fetching details: ' .
mysql_error() . '</p>');
} //end if

$rules=mysql_fetch_array($rules);
$ruletext=htmlspecialchars($rules['rules_text']);
//$newsdesc=htmlspecialchars($rules['news_desc']);

?>
<form name="rules" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="GET">
Rule descriptionbr />
<textarea name = "ruletext" rows="6" cols="100">
<?php echo $ruletext; ?></textarea>
<input type="hidden" name="ruleid" value="<?php echo $ruleid; ?>" />
<br /><input type="submit" value="SUBMIT" />
</form>
<?php endif; ?>
<?php endif; ?>
<p><a href="rules_admin.php">Back to rules</a> |
<a href="admin.php">Admin Page</a> |
<a href="index.php">Home</a></p>
<?php include 'footer.inc.php'; ?>
</body>
</html>