The code above isn't actually a full contact form. The 'submit button' is just a mailto: link, so all it will do is to launch the user's default e-mail client. In case the user doesn't have any, it will do nothing.
You need two things to build a contact form:
- A full HTML form
- Server-side code to handle the information sent through the form
You have the first part half-way done, but it is very cluttered. Dreamweaver is a very poor tool for making websites, as it will fill the code with all sorts of junk. Compare the code you have above with this code:
<form action="/receive-message.php" method="post">
<label for="contact-name" class="required-field">
<input type="text" name="contact-name" id="contact-name">
<label for="contact-email" class="required-field">
E-mail address <span>(required)</span>
<input type="text" name="contact-email" id="contact-email">
<input type="text" name="contact-phone" id="contact-phone">
<label for="contact-message" class="required-field">
<textarea name="contact-message" id="contact-message" cols="30" rows="6"></textarea>
<input type="submit" value="Submit">
The second requires that you set up some kind of script on your website, using a scripting language like PHP. There are plenty of tutorials out there for the scripting language that works on your web server (you can't execute PHP locally without setting up a web server on your computer). There are two things to be aware of when it comes to contact forms, however:
- Unless you make some kind of security measurement, you will receive lots of spam messages
- Unless you are careful in how you handle the information sent through the form, you site may be used by spammers to send the submitted message to other people as BCC.
Also, why set up such a small limit (40 characters) to the length of the name and e-mail address? If you submit the information to a database, the maximum technical length of VARCHAR is 255 characters. There is no reason why the field size should be limited, unless you are expect to receive litterally trillions of messages. Furthermore, it might make the form useless. My e-mail address is 35 characters, which is a problem for some forms, and there are no doubt people with longer e-mail addresses, not to mention names. Whenever I come across a store that needlessly limit their field size in a way that discriminate against my e-mail address, I will never use that business again. Is a few cents worth of harddrive spare really worth loosing a customer over?