R. Smith R. Smith - 17 days ago 7
Ajax Question

PHP Confusion.. Assistance please

I have made a signup page in PHP (pastebin to php below), Ive made it ask for your name, username, email, password(and confirm), gender and country. I can make it all go through except the first and last name, Its not posting to my database either. I think it wont post to the database because the names are not going through... I have tried a lot and in now completely stuck.. Ive tried google, youtube etc and i cant find anything... Can anybody help me?
Thanks in advanced

http://pastebin.com/waddq19W

Answer

In your code besides what was mentioned in the comments you have an if statement that is assigning variables.

if($f = "" || $l = "" || $u == "" || $e == "" || $p == "" || $g == "" || $c == ""){}

Notice the = and not == after $f and $l, it should be:

if($f == "" || $l == "" || $u == "" || $e == "" || $p == "" || $g == "" || $c == ""){}

This way you aren't replacing the original contents and are now checking the contents.

And for future an empty() check will check for "" or even unset POST variables, allowing you to check missing POST values and empty strings in 1 go.