In registrationprocess.php you check almost all of your variables like:
if(empty($_POST['somevar']) > X)
where "X" is replaced with a number. [man]empty[/man] returns a boolean (true | false) not an integer. So comparing whether true > 0 or false > 10, won't do you any good.
In all actuality I'd create a function in which I'd pass two arrays: (1) the array of data to test and (2) an array of key-names in the data array to look for (i.e. those fields that are required). Something like:
function isEmpty($data=false, $required=false)
{
if(!$data || !$required)
return false;
$return = true;
foreach($required as $key)
{
if(empty($data[$key]))
$return = false;
}
return $return;
}
Then in your code you could do:
if(!isEmpty($_POST, array('newusername', 'newpassword', 'confirmnewpassword', 'firstName', 'lastName', 'address', 'post_code', 'telephone', 'email', 'emailconfirm', 'tc'))
{
}
Now, to check lengths, you want to use [man]strlen[/man] to make sure passwords are greater-than 6 characters long. Once again, a simple function would suffice:
function isValidPassword($pass, $confirm, $len=6)
{
if(strlen($pass) < $len)
return false;
if(strcmp($pass, $confirm) != 0)
return false;
return true;
}
You can do something similar with the email address as well (checking to see if it's in a valid form). So your if now becomes:
$required = array('newusername', 'newpassword', 'confirmnewpassword', 'firstName', 'lastName', 'address', 'post_code', 'telephone', 'email', 'emailconfirm', 'tc');
if(!isEmpty($_POST, $required) || isValidPass($_POST['newpassword'], $_POST['confirmnewpassword'], 6))
{
}
Inside registration.php I notice on line 32 you have $POST[$newusername]. That should probably $POST['newusername'].
I also notice in registration.php that you loop through $citylist but make the options value based on the $POST array. If the $POST array isn't set, what value is being posted? An empty one 😉 You probably want:
foreach($citylist as $city)
{
$selected = (isset($_POST['city_drop']) && $_POST['city_drop'] == $city) ? true : false;
print '<option value="' . $city . '"' . ($selected ? ' selected="selected"' : '') . '>' . $city . '</option>';
}
The same goes for day, month, and year 🙁
Also note that the name "t&c" != $POST['tc']. What the name of the element is, is what will be in the $POST array. So if you want to see if $POST['tc'] is checked, you either need to (a) change the name of the checkbox in the form to "tc" or (b) change the $POST['tc'] to $_POST['t&c'].
I'd be willing to bet that what you're checking in registrationprocess.php isn't what s being sent and so you're being kicked back because what you're checking isn't there.
You say there are loads of errors. That usually means something is wrong. First, fix the errors you see (undefined variables, undefined array indexes, etc.). Then try your code. If you still can't get it working after you've gotten rid of the errors, that's when you need to look at your logic as being the issue. Not a second before then. So fix the errors, then try again.
I've told you what errors I see (I haven't tested your code). From there you should be able to fix these two scripts yourself. At least to a point where you can test without having errors all over the place.