A standard addition to any website is some kind of ability to contact the website owners. Whilst many have opted for the implementation of “chat” functionality, the tried-and-tested Contact form which sends an e-mail to the website owner is still a trusty addition to any website.

Before we code one up, let’s be sure we have an understanding of what is involved.

HTML is a static “language”. It is not capable of processing the information as such. The HTML form will simply accept data in the form fields and then submit that data via HTTP to a URL. That URL must have the ability to process the data received; in this instance, it must take the information we send to it and use it to compose and send an e-mail.

Let’s code one up in HTML5:

See the Pen HTML Contact form by David Fox (@foxbeefly) on CodePen.light

If you open the above in your browser, fill in the form and press Send your URL will end up looking something like the following:

http://www.stylus.co.za/stylus.co.za/mailprocessor.php?contactname=David+Fox&contactemail=davidhfox%40gmail.com&contactcell=0844233359%40&contactmessage=This+is+a+test+message.&contactcopy=on&ccmail=davidhfox%40gmail.com

I have created a PHP script to do the processing.

You are more than welcome to use the script on my server under the following conditions:

  • You credit my work visibly on your contact form with the following HTML code: <p>PHP Form processing script provided by MisterFoxOnline, <a href="www.stylus.co.za" target="_blank">www.stylus.co.za</a></p>
  • The script is only used for your PAT. No other use is permitted. Abuse of any kind (including but not limited to spam) of this service for any reason will be reported to your school as well as to the relevant authorities.
  • I will receive & store copies of all e-mails processed by this script, including various information transmitted with the request including IP addresses.
  • I will discontinue the service or block the use of the service at my discretion without notice at any time.

By foxbeefly

PHP / MySQL Developer

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.