For public-facing forms you should add a CAPTCHA or similar device, as you can see in our Feedback form below, or risk being bombarded by spambots.
Generate forms using PHP and validate forms using both Java Script and PHP - with a class we really believe in and also use every single day.
Finally, the code includes PHP commands to re-insert any submitted values back in to the form so they don't have to be retyped in case of an error.
You'll notice that we've used PHP to insert the form as the current page.
Page 4: Use a Perl CGI script to validate your HTML forms.
This article is part of the HTML Forms Tutorial This Perl script CGI snippet does the same thing as the Java Script.
If yes, the value of the $fname variable would be sent to the recipients email.
If the box is empty the $fname variable is set to NULL and the user sees the message "please fill out your first name" followed by a line break . empty($_POST['comments']))else $recipient = "[email protected]"; $subject = "Form Feedback"; $mailheaders = "Reply-to: $_POST[email]"; //send the mail mail($recipient, $subject, $msg, $mailheaders); ?