Latest News 
August 30, 2010
New feature: Allow other value for radios & checkboxes
August 26, 2010
New feature: field layout
August 23, 2010
New feature: form templates
"A very fine tool indeed. I am using 123ContactForm for years on my websites and I am happy with the performance. Highly recommended!..." - Manfred Kramesberger
Simple PHP contact form
A PHP contact form is built of two parts: the actual contact form (what visitors see) and the script that processes the filled form and sends the email. They can be located in two different files, or they can be located in the same file, as you will see in the example below. We will create a simple PHP contact form, that will require the user to enter his name, email and message (see the enclosed image). Below we will include the PHP contact form code, nicely highlighted, for your easy understanding. When the visitors opens the page with the form (live demo), the HTML code of the form is displayed (highlighted with black). After the users clicks the Send Email button, the user is taken to the same page, but a hidden parameter named action is set. This will prevent the script from displaying the form again and try to send the email (the code after the first else). The script verifies if all the fields were filled. If at least one was let empty, an error message is showed.
<?phpThat was it, we created a simple form. If you want to add other fields (radio buttons, checkboxes, textareas, dropdown lists) to the form, you have to add them to the script. If spammers start to automatically fill your form with garbage, you have to add a Captcha image verification. If the users mistype their emails, you have to add form validation. If you want your visitors to send you files with the contact form, you can let them upload files with the PHP contact form. All these features can be implemented in PHP, but they require advanced knowledge of PHP. An easier solution would be to use 123ContactForm, which offers all these features and many others. Don't hesitate! Sign up now! |








