Could someone lookat the php Sign up code please

This is a section of code from a Signup page, it is not working, not signing up.

I was looking at the code and notice the 2 BOLD areas, the code is different, 1 is just"" and the 2nd has “empty”

could someone tell me if this is correct? and what is correct ? Thank you :slight_smile:

$username = cleanInput($_POST[‘username’]);
$password = cleanInput($_POST[‘password’]);
$firstname = cleanInput($_POST[‘firstname’]);
$surname = cleanInput($_POST[‘lastname’]);
$email = cleanInput($_POST[‘email’]);
$age = cleanInput($_POST[‘age_list’]);
$children = cleanInput($_POST[‘children’]);

if ( $firstname!=“” and $surname!=“” and $email!=“” and $age!=“empty” and $children!=“empty” and $gender!=“empty” and $sexuality!=“empty” and $build!=“empty” and $height!=“empty” and $area!=“empty” and $town!=“empty” and $employment!=“empty” and $diet!=“empty” and $drink!=“empty” and $smoke!=“empty” and $religion!=“empty” ) {

		       $newMember = new Member();
			$newMember->firstname	  		= $firstname;
			$newMember->surname				= $surname;
			$newMember->username			= $username;

That could be right but not likely. Typically the default value of any form input is the empty string (that is, nothing or “” as you’ve seen). Those others are checking against the word “empty”. If your form loads and actually shows the word “empty” in a bunch of fields, then that code could be right. But if the fields are just blank, then they should be like $age != “” and $children != “” …

Thank you QMonkey for your quick helpful reply,

yes the difference is what alerted me, I will place “empty” inside those that are without empty and see what happens :slight_smile:

best wishes :slight_smile:

As well as the form, the cleanInput() function may return the string ‘empty’ in certain circumstances, though it’s hard to see why it would not be consistent.