[LEFT][COLOR=#000000][FONT=Arial]I have created a simple php page that needs to validate if the amount entered is greater than 100 or must return an error. My function though does not get called when psoting and the amount is less than 100
<html>
<head></head>
<title></title>
<style>
.error {color: #FF0000;}
</style>
<body>
<?php
function test_input($data)
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
$amountErr="";
$amount="";
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
if (($_POST["amount"])>100)
{$amountErr = "Value must be equal or greater than 100";}
else
{
$amount = test_input($_POST["amount"]);}
}
?>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<p><span class="error">*required field.</span></p>
Amount:<input type="text" name="amount"/>
<span class="error">*<?php echo $amountErr;?></span>
<input type="submit" value="Pay"/>
</form>
</body>
</html>
[/FONT][/COLOR][/LEFT]