Prev | Current Page 419 | Next

Craig Grannell

"The Essential Guide to CSS and HTML Web Design"

You need these two characters
at the end of each header except the last one. Second, there??™s a period in front
of the equal sign in the second and third lines. This has the effect of stringing all
the values together so the script treats the headers as a single block.
One nice touch with e-mail headers is to put the user??™s e-mail address in the
Reply-to field of the e-mail, so all the user has to do is click Reply in their e-mail
program to send a message back to the right person. Unfortunately, this is frequently
used by spammers to inject malicious code into your script. The code in
process_mail.inc.php filters out potential attacks and inserts the sender??™s e-mail
address only if it??™s safe to do so. Consequently, there is no need to add a Reply-to
header yourself; it??™s done automatically by the script.
If you want to use a special encoding, such as UTF-8, for your e-mails, make sure
the web page containing the form uses the same encoding in its meta tag.
You don??™t need to use all these headers. Just remove the complete line for any you
don??™t want.
11. You don??™t need to make any other changes to the code you inserted in step 3.
12. The script in process_mail.inc.php processes the form input and sends the e-mail
if there are no problems. The final stage is to let the user know what happened.
Immediately above the form in the main part of your page, insert the following
code:
if ($_POST && isset($missing) && !empty($missing)) {
?>

Not all required fields were filled in.


Pages:
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431