Doodely
Doodely

Reputation: 177

Registration page in PHP

I am creating a PHP registration page and I'm completely confused as to what to do next.

Whenever the form is validated correctly and submitted, the only table that gets updated is the USERS table and it needs to also update SecInfo and Shipping.

This is a class assignment, and I am trying to finalize the kinks. I can feel I am close if one the mysql_query's are working out of 3.

<?php
            ...                     
if($errorCount == 0){

$userSQL = "INSERT INTO Users(UserID, FName, LName, Email, Phone, Address, City, UserState, Zip) VALUES ('{$uName}', '{$fName}', '{$lName}', '{$email}', '{$phone}', '{$add}', '{$city}', '{$uState}', '{$zip}')";

$secSQL = "INSERT INTO SecInfo(UserID, Password, SQuestion, SAnswer) VALUES ('{$uName}', '{$sec_pwd}', '{$sQues}', '{$sAns}')";

$shipSQL = "INSERT INTO Shipping(ShipAdd, ShipCity, ShipState, ShipZip)VALUES ('{$shipAdd}', '{$shipCity}', '{$sState}', '{$shipZip}')";

mysql_query($userSQL);
mysql_query($secSQL);
mysql_query($shipSQL);

echo "Successfully submitted!";
}
}
}
else
echo "Form data missing for specific fields!";
}
?>

QUESTION: (If you need HTML you can ask) Is the code not inserting into SecInfo and Shipping because I am calling the mysql_query method too many times at the end?

This is a contained project, as in sql_injection isn't going to be an issue.

Upvotes: 0

Views: 185

Answers (1)

Zack
Zack

Reputation: 1703

Do you have a specific question? I'm confused as to what you need help with exactly. But I noticed you've got quit a bit of SQL/PHP jumbled up into a long sequence of tasks. My advice, would be to start small, test your code, then carefully add new pieces of code and test it constantly, this is how you will understand where the error lies, and why the SecInfo and Shipping tables are not being updated.

Also, it looks like there is a lot of unnecessary stuff in your code, if all your doing is updating/adding to 3 tables, you shouldn't need that many lines of code. hope this helps.

Upvotes: 1

Related Questions