somiadiscon Posted August 7, 2006 Share Posted August 7, 2006 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 More sharing options...
Jack McKalling Posted August 7, 2006 Share Posted August 7, 2006 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. Link to comment Share on other sites More sharing options...
somiadiscon Posted August 7, 2006 Author Share Posted August 7, 2006 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 okRemove 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 Link to comment Share on other sites More sharing options...
Jack McKalling Posted August 7, 2006 Share Posted August 7, 2006 *Thinks he has been drinking too many beers* Oh wait, lol.And, does it help? Link to comment Share on other sites More sharing options...
justsomeguy Posted August 7, 2006 Share Posted August 7, 2006 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now