Jump to content

php issue


somiadiscon
 Share

Recommended Posts

I am using 5.1.4 php with a 1.3.x apache server i am not using mySQL normaly below php file show end-user to age is older or younger but this time nothing in my browser so why is that any one can help me to figure this out thanx :) <?php if ($_POST) { $age = $_POST['age']; if ($age < "14") { echo "You are younger than 14"; } else { echo "You are older than 14"; } } else { echo "<h4>Age Checker Software!</h4>"; echo "<form action=age.php method=post>Your Age:<input type=text name=age><br /><br />"; echo "<input type=submit value=Go!></form>"; } ?>

Link to comment
Share on other sites

Remove the quotes embedding the number you are comparing to :)This would cause the script think it is an actual numberr instead of a string. :)
thanx man i will try and see ok
Remove the quotes embedding the number you are comparing to :)This would cause the script think it is an actual numberr instead of a string. :blink:
thanx man i will try and see ok :blink:
Link to comment
Share on other sites

This would cause the script think it is an actual numberr instead of a string.
It is actually fine if it is a string, because the value in the $_POST array is also a string. But even if it wasn't he would at least get the message in the else statement if the condition evaluated to false.You might want to change this:if ($_POST)to this:if (isset($_POST['age']))
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...