Specifications

The gray form on this page is output by the function display_registration_form(),
contained in output_fns.php. When the user clicks on the Register button, he will be taken to
the script register_new.php. This script is shown in Listing 24.6.
LISTING 24.6 register_new.phpThis Script Validates the New Users Data and Puts It in
the Database
<?
// include function files for this application
require_once(“bookmark_fns.php”);
// start session which may be needed later
// start it now because it must go before headers
session_start();
// check forms filled in
if (!filled_out($HTTP_POST_VARS))
{
do_html_header(“Problem:”);
echo “You have not filled the form out correctly - please go back”
.” and try again.”;
do_html_footer();
exit;
}
// email address not valid
if (!valid_email($email))
{
do_html_header(“Problem:”);
echo “That is not a valid email address. Please go back “
.” and try again.”;
do_html_footer();
exit;
}
// passwords not the same
if ($passwd != $passwd2)
{
do_html_heading(“Problem:”);
echo “The passwords you entered do not match - please go back”
.” and try again.”;
do_html_footer();
exit;
Building Practical PHP and MySQL Projects
P
ART V
508
30 7842 ch24 3/6/01 3:34 PM Page 508