A popup contact form has many benefits. You can add a button/link in every page that pops up the contact form in a modal popup. That makes the contact form easily accessible from any part of the website.
Your web site visitors do not have to ‘hunt’ for the ‘contact us’ page.
Download the popup contact form code
You can download the contact form that best fits your needs and then customize as required.
Features of the popup contact form
- Easy to customize
- Standards compliant (100% XHTML 1.0 strict validated, uses CSS)
- Secured against spam bots and attacks
- Ajax submission.
- Hosted on your own web server
- Free!
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, /contact)
- See the page a-page.php for an example of integrating a button/link to the popup contact form.
- Include the file popup-contactform.php at the beginning of your php file
- link to the style file popup-contact.css in the
<head>section of your page - PHP include contactform-code.php at the end of your php file (it should come in between
<body>and</body>) - To Open the Popup form on clicking a link, use the code below:
$formproc->AddRecipient('name@your-website.com');//<<---Put your email address here
<a href='javascript:fg_popup_form("fg_formContainer","fg_backgroundpopup");'>Contact us</a>
Customizing the form
To change the style of the form, edit popup-contact.css.
You can add any type of additional fields to the form. The fields will automatically appear in the form submission emails.
For client side validations, this script uses the JavaScript validation library. You can add additional client side validations using the same library. (See the documentation here: JavaScript form validation library).
Additional server side validations can be added in the file ‘include/fgcontactform.php’ Validate() function.
License

The code is shared under LGPL license. You can freely use it on commercial or non-commercial websites.







← Previous Comments
modal?
Again just another home run! 99.9% of my clients could care less about a contact form being super flashy, or graphically intense. Most just want it to work and want it to work right. There is no second guessing with this form, and it saves me so much time when its 2:30am I am falling asleep at my desk and still need a form. This is my go to sleep saver!
if i want to check it on local host that mail function is working or not..cuse i want to check before uploading my site that mail fuction is alright or not…What to do…….?????
great…i works fine in local host..but in server it shows javascript error..
Followed the instructions completely but it does not work!
1. If you wanna to work this in its own folder, you must append absolute path to every link to .php, .js and .css files wherever you find it. after this its work fine.
2. readme.txt has some errors, right words in a-page.php
this contact form is awesome, if i could just get it in blue this would work well with my travel site
I’ve followed all editing tips, yet the pop-up form still wouldn’t open. Can some of the guys who have successfully achieved this ‘feat’ kindly be a lifesaver and share their own methods please? Cheers!
Guys if the pop up isnt working its because there is a missing variable in this line here which goes in the index.php: href=’javascript:fg_popup_form(“fg_formContainer”,”fg_backgroundpopup”,)
you will find this line in the original tutorial, all you need to do is add a variable, so just copy and paste this to replace the original and hey presto!:
href=’javascript:fg_popup_form(“fg_formContainer”,”fg_backgroundpopup”,”wrapper”)
Testing on localhost I keep getting this: ( ! ) Warning: require_once(itemsgalore.biz/contact_seller/popup-contactform.php) [function.require-once]: failed to open stream: No such file or directory in C:\Wamp\www\Itemsgalore.biz\contact_seller\popup-contactseller.php on line 10
Tried integrating both popup with and without captcha — neither one worked.
Firebug shows the first line in function fg_popup_form,
var bgdiv = document.getElementById(bg_div_id);
resolves to bgdiv = null
Script hangs after that.
Seems like a lot of effort on my part to make such a simple script work
Replace this line: href=’javascript:fg_popup_form(“fg_formContainer”,”fg_backgroundpopup”,)
with this line in the index.php:
href=’javascript:fg_popup_form(“fg_formContainer”,”fg_backgroundpopup”,”wrapper”)
just add a third variable (like ‘wrapper’ above) and it works fine!
thanks to the devs for making this form for us!!
This is anything but simple. The only way I could get it to work was to put all my page file sin the ROOT.
← Previous Comments
Comments on this entry are closed.