I have an HTML form and PHP $_SESSION validations to give out errors and it’s supposed to require a database insert file called “signuppdo.php” if the errors are all null. For some reason, even though the errors are null and i submit, it doesnt require the signuppdo.php. It may be the if statement. What could it be? Here’s my code:
[php]
<?php session_start(); if (isset($_SESSION["login"])) { header("Location: index.php"); } $fname=$_POST["fname"]; $lname=$_POST["lname"]; $email=$_POST["email"]; $password1=$_POST["password1"]; $password2=$_POST["password2"]; $aboutme = $_POST["aboutme"]; if($_SERVER['REQUEST_METHOD'] == "POST") { if (empty($fname) || strlen($fname) > 20) { $_SESSION["fname"]= "Please enter your first name"; } if ($fname!=null And strlen($fname) < 20) { $_SESSION["fname"]= ""; } if (empty($lname) || strlen($lname) > 20) { $_SESSION["lname"]= "Please enter your last name"; } if ($lname!=null And strlen($lname) < 20) { $_SESSION["lname"]= ""; } if (empty($email) || strlen($email) < 10 || strlen($email) > 40) { $_SESSION["emails"]= "Please enter your valid E-mail Address"; } if (strlen($email) < 40 And strlen($email) > 10) { $_SESSION["emails"]= ""; } if (empty($password1) || strlen($password1) < 3 || strlen($password1) > 40) { $_SESSION["password"]= "Please choose a password for your account (All passwords must be between 4-40 characters)"; } if (strlen($password1) < 40 And strlen($password1) > 3) { $_SESSION["password"]= ""; } if($password2 != $password1) { $_SESSION["confirm"]= "Please enter the password you entered above"; } if($password2 == $password1) { $_SESSION["confirm"]= ""; } if (strlen($aboutme) < 10 || strlen($aboutme) > 200) { $_SESSION["aboutmes"] = "Please give us some information about yourself (Must be between 10-200 characters)"; } if (strlen($aboutme) > 10 And strlen($aboutme) < 200) { $_SESSION["aboutmes"] = ""; } if (($_SESSION["fname"] == "") && ($_SESSION["lname"] == "") && ($_SESSION["emails"] == "") && ($_SESSION["password"] == "") && ($_SESSION["confirm"] == "") && ($_SESSION["aboutmes"] == "")) { require "signuppdo.php"; //This is the file it's supposed to submit to, but for some reason it ignores the script } } ?> G.B. -- Sign up
Sign up
Sign up for G.B. -- With your account, you may customize your chapter, to show off your talents!
" method="POST" >First Name: <?php echo $_SESSION["fname"]; ?>
Last Name: <?php echo $_SESSION["lname"]; ?>
E-mail Address: <?php echo $_SESSION["emails"]; ?> <?php echo $_SESSION["existemail"]; ?>
Choose a Password: <?php echo $_SESSION["password"]; ?>
Confirm Password: <?php echo $_SESSION["confirm"]; ?>
About Me:
<?php echo $_POST["aboutme"]; ?> <?php echo $_SESSION["aboutmes"]; ?>I Agree with the Terms and Conditions
[/php]