I'm basicaly trying to make the script post to itself and if there are fields left blank it tells the user that all fields need to be filled in. If they are filled it will give the solution for the calculation.
I was attempting to do an if/else statment but it isn't working. Any help would be appreciated.
<?
if (($REQUEST_METHOD=='POST')) {
for(reset($HTTP_POST_VARS);
$key=key($HTTP_POST_VARS);
next($HTTP_POST_VARS)) {
$this = addslashes($HTTP_POST_VARS[$key]);
$this = strtr($this, ">", " ");
$this = strtr($this, "<", " ");
$this = strtr($this, "|", " ");
$$key = $this;
}
if ($rent && $balance ) {
echo "The balance is $balance and the rent is $rent <br>";
$day = 13;
$month = 11;
$year = 2002;
$x = $balance / $rent;
$current = mktime("","","",$month,$day,$year);
echo date('m-d-Y', mktime (0,0,0,$month + $x,$day,$year ));
} else {
$notall == 1;
}
}
?>
<BODY>
<?
Echo "$notall";
if ($notall == 1) {?>
<P><FONT COLOR="red">Please answer all fields</FONT></P>
<? } ?>
<FORM METHOD="POST" ACTION="http://localhost/ptd.php">
<PRE>
Rent: <INPUT TYPE ="text"
NAME="rent"
SIZE="20"
MAXLENGTH="50">
<BR>
Current Balance: <INPUT TYPE ="text"
NAME="balance"
SIZE="20"
MAXLENGTH="50">
<INPUT TYPE="submit" VALUE="Calculate PTD">
</PRE>
</FORM>
<?
if ($notall = "1") {
echo "Your PTD is: <B>";
echo date('m-d-Y', mktime (0,0,0,$month + $x,$day,$year ));
echo "</B>";
}
?>