|
Contact Forms - The PHP ScriptThe feedback.php form takes the form information and packages it into an email which is sent to the contact address. At the end the visitor is returned to the website usually to a thank you page. The script is below with parts of it highlighted. Here a link to the script You are free to copy and use this script (at your own risk). How it WorksThe parts highlighted in yellow need to be changed to suit your site. If the script detects an error e.g. a missing field it will send the visitor back to the form page. If everything is ok an email is sent to the recipient (should be one of your valid email addresses) with the text of the feedback and the email address of the visitor. The visitor is then sent to the thank you page. This page can be used for a variety of things which I will include in another article) but often it just has a quick note saying thank you and contains a link to the home page. Spam ProtectionIf you take a look at the code highlighted in grey. This bit of code analyses a field in the form looking for a particular value which the visitor needs to enter or the form gets rejected. The value is highlighted in blue. All you need to do is include a prompt on the form to enter the value. This prompt you should put near the submit button. Here is the part of the form showing the prompt: To make it more secure you can use a graphic for the code and change it periodically. If you change it you will need to change the php form to detect the new code (shown in blue). Here is the complete form which you are free to copy and use
In
|
|
|