Im a newbie. Started learning php about a month ago.
i need help understanding whats wrong with my logic in trying to confirm that the user has submitted the correct info.
Errors
- email address doesnt seem to verify even when its correctly inputted.
-password also shows error.
Here is the code
<?php
//Includes mass includes containing all the files needed to execute the full script
//Also shows homepage elements without customs
include ("includes/mass.php");
//Reigstration Form
$register = "<div id='registration'>
Register Here!
<form action='register.php' method='post'>
Username<input type='text' name='username'>
</br>
Password<input type='password' name'password'>
</br>
Firstname<input type='text' name='firstname'>
</br>
Lastname<input type='text' name='lastname'>
</br>
email-address<input type='text' name='email'>
<br>
<input type='submit' name='submit' value='Sign Up'>
</form>
</div>";
echo $register;
//Grabbing data form POST array and storing in variables
$username = $_POST['username'];
$password = $_POST['password'];
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$email = $_POST['email'];
$submit = $_POST['submit'];
//Check to make sure user has submitted the correct details
if (isset($submit))
{
if (strlen($username)<2) // put || ($username==(same as value on the database)
{
echo ("<br>You must enter a longer username</br>");
}
elseif (strlen($password)<=6)
{
echo ("<br>You must enter a longer password<br>");
}
if (strlen($firstname)<=0)
{
echo ("You must enter your firstname<br>");
}
elseif (strlen($lastname)<=0)
{
echo ("You must enter your firstname<br>");
}
if ( preg_match('/@/',$email) || (strlen($email)<=6) )
{
echo ("You must enter a proper email add");
}
}
else
{
//push this information to the database
echo "successfully submitted your **** to the database";
}
?>