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.
Related posts:






{ 89 comments }
← Previous Comments
Next Comments →
Hi..

I am wondering if there is a way or a function to pass name and email data from form to the thank you page.. ? I am quite new to this and would appreciate any guidance you could provide. Also the modal box seems to retain the thank you page once its finished unless you refresh the page.. The page I am working on may get multiple contact forms filled out during a session and was wondering if there was a way of resetting the form away from the thank you page ready for the next input..
Thanks in advance.
Best Regards
Stuart
Thank you. just added to my website. easy to use.
How do i implement your form using smtp server with authentication to send mail
Regards
Thank you very much. It is very nice and easy to implement. Great…
Hi,
Since you have had ‘better luck’ with this script, I wonder if you could kindly assist with my own rendering please? When I click on the link, nothing happens.
It is very good tool.
Thanks for your help.
I am having the same error “Automated submission prevention: case 1 failed”. I don’t see a solution posted for the cause. What am I doing wrong?
Thanks
hi,
This is absolutely wonderful, just want to say thank you very much, solved my problem, very stylish and secure too!! good job
Hello, I like this script very much, really its best of the best contact forms with full variety. I would like to integrate it on my site but no luck everything is fine captcha also works fine but i cant received email from my newly registered domain (website) contact form.
My host says only through SMTP with authentication to send mail. Can someone please tell where i can get a simple download and paste scrip for SMTP mail servers ?
Thanks for this script. You save my problem.
Hi, I can’t include php file on my html files, is there any other way to use this form on html files.
(I can’t change html to php or use htaccess , my file should stay html)
Thanks for any help.
great article, put it on my website, check it out.
I like the design and programming of your modal form, however like some others here the form wouldn’t send. After submitting, nothing happens – not even an error code appears. I suspect could be due to my host which is GoDaddy.com. The most basic mail() command works there, but nothing else.
Unfortunately I have run out of ideas on how to still use the original code. I am currently replacing the lines in SendFormSubmission() within fgcontactform. Seems the only viable option for now for me.
Do you have any suggestions for me? Many thx in advance!
Also, I noted a small error in the contactform-code.php: the line
var formobj = document.forms['contactus']
is missing a ; at the end. So the correct line should read:
var formobj = document.forms['contactus'];
in order to make the script work I believe…
Thanks for valuable example
Hi, how to insert the data into the database
this is exactly what i was looking for…thank you for sharing!!!
hi there,
thanks for the tutorial, i have a little problem – the popup does not open but i have followed all steps exactly
any clues?
very helpful this code.and easy way to use
Thanks .
As you have found the code easy to use, Vibhuti, perhaps you wouldn’t mind showing the changes YOU had to make to the scripts and where exactly you made those changes. You would be saving the life of a novice. Thanks, pal.
please i want your help just i want popup code with out contact form can you please help me because this for my college project
← Previous Comments
Next Comments →
Comments on this entry are closed.