I'm newbie in php.
Can anyone tell me why this code isn't working? I know i am missing something just cant figure out what. I am trying to test a form that sent a variable through a form to a php scipt like this:
Code: Select all
<html>
<head><title>ageist</title></head>
<body>
<form action="ageist.php" method="post">
Enter Your Age: <input name="age" size="2"> <br />
<input type="submit" value="send">
</form>
</body>
</html>THE PHP SCRIPT:
Code: Select all
<html>
<head></head>
<body>
<?php
// retrieve form data
$age = $_POST['age'];
// check entered value and branch
if ($age >= 21) {
echo 'Come on in, we have alcohol and music awaiting you!';
}
if ($age < 21) {
echo "You're too young for this club, come back when you're a little older";
}
?>
</body>
</html> If anyone knows whats wrong could you please explain. thanks