Im making a simple "age verification" page, using $_GET & IF but I am getting a syntax error; "Parse error: syntax error, unexpected T_IF in /home/.../public_html/verifyage.php on line 12" I am a virgin to PHP and don't know what that error means here is the code: <html> <head><title>$GET Test</title></head> <body> <form action="verifyage.php" method="get"> Name:<input type="text" name="name" /> Age:<input type="text" name="age" /> <input type="submit" /> </form> <br> <?php $age = $_GET["age"] if ($age < 18) { echo "You are not old enough to enter this site."; } ?> </body> </html> PHP:
You need to add ; at the end of each statement ( in this case, variable definition and if block are two separate statements ) : <html> <head><title>$GET Test</title></head> <body> <form action="verifyage.php" method="get"> Name:<input type="text" name="name" /> Age:<input type="text" name="age" /> <input type="submit" /> </form> <br> <?php $age = $_GET["age"]; if ($age < 18) { echo "You are not old enough to enter this site."; } ?> </body> </html> PHP: