Having file upload boxes in contact forms will be greatly convenient for some web sites. For example, if the visitor can attach his/her photo and resume, that will greatly enhance the form’s functionality. Here is a contact form that you can customize for your needs.
Download the contact form code
You can download the contact form that best fits your needs and then customize as required.
Features of the contact form
- You can have any number of file upload boxes
- Standards compliant (100% XHTML 1.0 strict validated, uses CSS)
- Secured against spam bots and attacks
- Easy to customize
- Hosted on your own web server
Installing the contact form on your web site
- Unzip the downloaded contact form code.
- Edit contactform.php and edit the email address to your email address
- Upload the folder contents to your website (to a sub-folder say,
- The contactform.php contains the form. You can link to this file or embed the form using iframe.
$formproc->AddRecipient('firstname.lastname@example.org');//<<---Put your email address here
Here is sample iframe code to embed the form:
<iframe src='/contact/contactus.php' frameborder='0' width='100%' height='600' ></iframe>
Alternatively, you can modify contactform.php to have the same look of your web site.
Customizing the form
If you want to add one more file upload box, do the following:
- open contactus.php in a text editor
- Add the HTML code for the file upload box(just like the existing one for the photo). Gove another unique name and id for the file upload box
- Add one more line on the top of the contactus.php
<div class='container'> <label for='photo' >Another upload:</label><br/> <input type="file" name='newupload' id='newupload' /><br/> <span id='contactus_newupload_errorloc' class='error'></span> </div>
$formproc->AddFileUploadField('photo','jpg,jpeg,gif,png,bmp',2024); $formproc->AddFileUploadField('resume','doc,docx,pdf,txt',2024); $formproc->AddFileUploadField('newupload','',2024);//<<------- New file upload
You can edit the contact.css file to change the style of the form.