Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //check email
- if (isset($_POST['email'])) {
- $email = stripslashes($_POST['email']);
- $email = trim($email);
- //check email format
- if (strlen($email) == 0 || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
- echo "<p>Your email number is required and must be a valid format.</p>n";
- ++$FormErrorCount;
- }
- //check to see if email already exists
- include("inc_db_conference.php");
- $DBConnect = new mysqli ($config['db_host'], $config['db_user'], $config['db_password'], $config['db_name']);
- if($DBConnect !== FALSE) {
- $TableName = "personal";
- $select = "SELECT email FROM $TableName WHERE email=$email";
- }
- $QueryResult = mysqli_query($DBConnect, $select);
- if($QueryResult !== FALSE) {
- echo "<p>This email is already being used. Go back to the form and use a different email to register.</p>";
- ++$FormErrorCount;
- }
- //mysqli_close($DBConnect);
- } else {
- echo "<p>Form submittal error (No 'email' field)!</p>n";
- ++$FormErrorCount;
- }
- //if data is present, send to database
- if ($FormErrorCount == 0) {
- include("inc_db_conference.php");
- $DBConnect = new mysqli ($config['db_host'], $config['db_user'], $config['db_password'], $config['db_name']);
- if($DBConnect !== FALSE) {
- $TableName = "personal";
- $SQLstring = "INSERT INTO $TableName "."(firstName, lastName, address, city, state, zip, phone, email) VALUES ".
- "('$firstName', '$lastName', '$street', '$city', '$state', '$zip', '$phone', '$email')";
- }
- $QueryResult = mysqli_query($DBConnect, $SQLstring);
- if($QueryResult === FALSE)
- echo "<p>Unable to insert the values into the personal information table. Error code ".mysqli_errno($DBConnect).": ".mysqli_error($DBConnect)."</p>";
- else
- echo "<p>Your information has been saved. Please continue with your registration <a href='CompanyInfo.php?".SID."'>on the next page</a>.</p>";
- }
- mysqli_close($DBConnect);
- } else {
- echo "<p> Please return to the <a href='PersonalInfo.php?".SID."'> Personal Information form</a> to correct the errors mentioned above.</p>";
Add Comment
Please, Sign In to add comment