based on your advice, I will check my code, then if need be, I'll reference to yours 🙂
Seem's to be sorted 😃 I had to reference to yours, but I think I have it working now 😃 I won't mark the thread resolved just yet, because I probably have many more questions on the same thing :S
EDIT:
hehe, toldya I'd be back 😉 Right, the new problem is simple, it's just not registering the customer/webfriend now. No error. Just "doing nothing". Maybe I can add in some echo's to see what is wrong, but I'm echoing the variable wf or cx (er, webfriend and customer) and they are just fine...
/**
* This variable will hold all the empty value names.
* That way, we can give the user some feedback about
* just what fields they are missing, and such.
**/
$empty = array(); // Default it to an empty array
if ( !isset($_POST['username']) || empty($_POST['username']) )
{
// If the username isn't set, or is empty:
// add it to our $empty array
array_push($empty, 'username');
}
if ( !isset($_POST['password']) || empty($_POST['password']) )
{
// If the password isn't set, or is empty:
// add it to our $empty array
array_push($empty, 'password');
}
if ( !isset($_POST['passconfirm']) || empty($_POST['passconfirm']) )
{
// If the confirmation password isn't set, or is empty:
// add it to our $empty array
array_push($empty, 'passconfirm');
}
if ( !isset($_POST['email']) || empty($_POST['email']) )
{
// If the email isn't set, or is empty:
// add it to our $empty array
array_push($empty, 'email');
}
if ( !isset($_POST['emailconfirm']) || empty($_POST['emailconfirm']) )
{
// If the confirmation email isn't set, or is empty
// add it to our $empty array
array_push($empty, 'emailconfirm');
}
if(count($empty)==0)
{
// We don't have any errors, so continue with whatever
if($_POST['password'] == $_POST['passconfirm'])
{
if($_POST['email'] == $_POST['emailconfirm'])
{
if ( $usertype == "webfriends" ) {
echo 'wf '.$usertype . '<br />';
$sql = "INSERT INTO webfriends (username, firstname, surname, password, alone, altwo, althree, county, country, daytime, evening, mobile, dob, email, postcode) VALUES ('$username', '$firstname', '$surname', '$password', '$alone', '$altwo', '$althree', '$county', '$country', '$daytime', '$evening', '$mobile', '$dob', '$email', '$postcode')";
if (@mysql_query($sql)) {
echo 'registration successful!';
}
}
else if ( $usertype == "customer" ) {
echo 'cx '.$usertype . '<br />';
$sql = "INSERT INTO customers (username, firstname, surname, password, alone, altwo, althree, county, country, daytime, evening, mobile, dob, email, postcode) VALUES ('$username', '$firstname', '$surname', '$password', '$alone', '$altwo', '$althree', '$county', '$country', '$daytime', '$evening', '$mobile', '$dob', '$email', '$postcode')";
if (@mysql_query($sql)) {
echo 'registration successful!';
}
}
else if ( $usertype == "both" ) {
echo 'both'.$usertype . '<br />';
$sql = "INSERT INTO webfriends (username, firstname, surname, password, alone, altwo, althree, county, country, daytime, evening, mobile, dob, email, postcode) VALUES ('$username', '$firstname', '$surname', '$password', '$alone', '$altwo', '$althree', '$county', '$country', '$daytime', '$evening', '$mobile', '$dob', '$email', '$postcode')";
if (@mysql_query($sql)) {
echo 'registration successful!';
}
$sql = "INSERT INTO customers(username, firstname, surname, password, alone, altwo, althree, county, country, daytime, evening, mobile, dob, email, postcode) VALUES ('$username', '$firstname', '$surname', '$password', '$alone', '$altwo', '$althree', '$county', '$country', '$alone', '$daytime', '$evening', '$mobile', '$dob', '$email')";
if (@mysql_query($sql)) {
echo 'registration successful!';
}
} else {
echo '<p>Error registering: ' .
mysql_error() . '</p>';
}
// Query All entries
$result = @mysql_query('SELECT * FROM webfriends');
if (!$result) {
echo ('<p>Error performing query: ' .
mysql_error() . '</p>');
}
}
else
{
echo 'Email addresses didn\'t match. Sorry.';
}
}
else
{
echo 'Passwords didn\'t match. Stopping processing.';
}
}
else
{
echo 'Please fill in all the required info. You did not fill in the following:<br>';
foreach($empty as $field)
{
echo $field.'<br>';
}
}
?>