HTML Tutorial Contact Form

Forms are used to collect data, as an example the contact page on this website is a form used to collect the data. A PHP script is required to communicate with the form and to then forward the collected data to your personal email.

Please refer to the code below, this is the code than makes up the html contact page form for this website, you can view a demonstration of the fields created below the code, alternatively open our contact page to see how it operates.

<form action="yourscript.php" method="post" enctype="multipart/form-data" name="form1" id="form1">


<input name="email" type="text" id="email" size="30" maxlength="40" />


Email *

<input name="name" type="text" id="name" size="30" maxlength="40"/>

Name *

<input name="subject" type="text" size="30" maxlength="80" />

Subject *

<select name="find" id="find">
<option>Where did you find us</option>
<option>Google</option>
<option>YouTube</option>
<option>Yahoo</option>
<option>A Friend</option>
<option>Other</option></select>




<textarea name="comments" cols="50" rows="10" id="comments"></textarea>




HTML Form Buttons

All Forms require a form button to send the information, most forms also have a clear button to auto clear/reset the form should the visitor want to refresh the information.


HTML Forum Validation

To prevent Spam or incorrect information being gathered by the form we can include a form validation by adding code to the submit button.

<input name="submit" type="submit" id="submit" onclick="MM_validateForm('email','','RisEmail','name','','R','comments','','R');return document.MM_returnValue" value="Send Email" />


HTML Tips

If using Dreamweaver the form library can be located in the main menu by following Insert - Form. No coding knowledge is required as Dreamweaver inserts the textfields, textareas and buttons by slecting that particular option.

comments powered by Disqus