let me take some of this:
1. Form actions.
the way i do it is have a hidden field in the form, the 1st form created would be
<form type="hidden" name="do" value="check">
sort of thing and then for second one you would do
<form type="hidden" name="do" value="email">
Then your php script is going to have 3 sections like
PHP Code:
if (!$do) {
print the first form
} elseif ($do == "check") {
print the checking form with variables from first
} elseif ($do == "email") {
send emails
display thank you note
} else {
major error, how on earth did they get here! only by typing in the query string do=sdfsdf or something
display erorr message
}
that is your setup.
To confirm an email use the function
PHP Code:
function check_email ($str) {
// returns 1 if a valid email, 0 if not
if (ereg ("^.+@.+\\..+$", $str)) {
return 1;
} else {
return 0;
}
}
then call it like:
PHP Code:
if (!check_email ($email)) {
$submit = 0;
$email = "<B>Invalid E-mail Address</b>";
}
if you are only using it once it might not be worth doing it as a function but good practice.
Emails:
just do the code twice for sending an email once with your email, once with theres with different message and subject.
Bookmarks