hey there, i’ve been trying to sort this out for the past couple of days. i just wind up in the same “error” of no d.o.b entered.
i’m running off of coffee, and brats of mine are crazier than i am at this point.
any help would be appreciated
[code]
<?php // This script is a query that INSERTs a record in the users table. // Check that form has been submitted: if ($_SERVER['REQUEST_METHOD'] == 'POST') { $errors = array(); // Initialize an error array. // Check for a first name: if (empty($_POST['fname'])) { $errors[] = 'You forgot to enter your first name.'; } else { $fn = trim($_POST['fname']); } // Check for a last name: if (empty($_POST['lname'])) { $errors[] = 'You forgot to enter your last name.'; } else { $ln = trim($_POST['lname']); } // Check for an email address: if (empty($_POST['email'])) { $errors[] = 'You forgot to enter your email address.'; } else { $e = trim($_POST['email']); } // Check for a birthdate: if (empty($_POST['birthdate'])) { $errors[] = 'You forgot to enter your birthdate.'; } else { $fn = trim($_POST['birthdate']); } // Check for a password and match against the confirmed password: if (!empty($_POST['psword1'])) { if ($_POST['psword1'] != $_POST['psword2']) { $errors[] = 'Your two password did not match.'; } else { $p = trim($_POST['psword1']); } } else { $errors[] = 'You forgot to enter your password.'; } if (empty($errors)) { // If everything's OK. // Register the user in the database... require ('./mysqli_connect.php'); // Connect to the db. // Make the query: $q = "INSERT INTO users (user_id, fname, lname, email, psword, birthdate, registration_date) VALUES (' ', '$fn', '$ln', '$e', SHA1('$p'), '$b', NOW() )"; $result = @mysqli_query ($dbcon, $q); // Run the query. if ($result) { // If it ran OK. header ("location: register-thanks.php"); exit(); // Print a message: //echo '
Thank you!
//You are now registered. In Chapter 12 you will actually be able to log in!
System Error
You could not be registered due to a system error. We apologize for any inconvenience.
'; // Debugging message: echo '' . mysqli_error($dbcon) . '
Query: ' . $q . '
//header ("location: register-thanks.php");
exit();
} else { // Report the errors.
//header ("location: register-page.php");
echo '<h2>Error!</h2>
<p class="error">The following error(s) occurred:<br>';
foreach ($errors as $msg) { // Print each error.
echo " - $msg<br>\n";
}
echo '</p><h3>Please try again.</h3><p><br></p>';
}// End of if (empty($errors)) IF.
} // End of the main Submit conditional.
?>
Register
First Name:
Last Name:
Email Address:
Birth Date: - Year - 1993 1992 1991 1990 1989 1988 1987 1986 1985 1984 1983 1982 1981 1980 1979 1978 1977 1976 1975 1974 1973 1972 1971 1970 1969 1968 1967 1966 1965 1964 1963 1962 1961 1960 1959 1958 1957 1956 1955 1954 1953 1952 1951 1950 1949 1948 1947 - Month - January Febuary March April May June July August September October November December - Day - 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 <?php if (isset($_POST['birthdate'])) echo $_POST['birthdate']; ?>" >
Password:
Confirm Password:
[/code]