You are here: Home » All Posts » Contact Forms » Here is a simple popup contact form (modal popup)

Here is a simple popup contact form (modal popup)

in Contact Forms

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.

Simple popup contact form
Simple popup contact form with three fields: Name, Email and Message
Try the DemoDownload
Popup form with Captcha
Popup contact form with Captcha image verification
Try the DemoDownload

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

  1. Unzip the downloaded contact form code.
  2. Edit contactform.php and edit the email address to your email address
  3. $formproc->AddRecipient('name@your-website.com');//<<---Put your email address here
    
  4. Upload the folder contents to your website (to a sub-folder say, /contact)
  5. See the page a-page.php for an example of integrating a button/link to the popup contact form.
  6. Include the file popup-contactform.php at the beginning of your php file
  7. link to the style file popup-contact.css in the <head> section of your page
  8. PHP include contactform-code.php at the end of your php file (it should come in between <body> and </body>)
  9. To Open the Popup form on clicking a link, use the code below:
  10. <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.

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay

Related posts:

  1. A simple, easy PHP contact form

{ 68 comments… read them below or add one }

kay December 14, 2011 at 8:34 pm

i am using Popup contact form with Captcha image verification but it keep returning this error: Automated submission prevention: case 1 failed; what could be the cause.

Reply

Dante January 21, 2012 at 12:55 am

i am having this very same problem. it would be great if anyone knew how to help :(

Reply

Eric Aquili December 15, 2011 at 6:44 am

Hi,

i downloaded the 2nd popup contact form with the Captcha verification and when i try loading it and click on contact us, the link to were it should execute is shown below javascript:fg_popup_form etc, but the popup form is not displayed. The strange thing is that i downloaded this form some months ago and it worked immediately…Any ideas on what might be the problem please?

Thanks,Eric..

Reply

gopal December 16, 2011 at 1:20 pm

I tried to use it….. when the page opens up its showing the contact form div…. pls help

Reply

Jenn December 28, 2011 at 10:19 am

I am having the same problem as Kay… ” i am using Popup contact form with Captcha image verification but it keep returning this error: Automated submission prevention: case 1 failed; what could be the cause.”

Can anyone help?

Reply

Paul Schiller December 29, 2011 at 3:28 am

Before using my contact.php page, I uploaded all files including ‘a-page.php’ to do some testing of functionality — getting this error:

Parse error: syntax error, unexpected ‘<' in /home/paulgs/chathamhousing.org/a-page.php on line 31

Reply

Paul Schiller December 29, 2011 at 3:31 am

resending, using .org instead of .com on my website (ooops)

did not modify anything except placed .css in my ‘_css’ folder

Parse error: syntax error, unexpected ‘<' in /home/paulgs/chathamhousing.org/a-page.php on line 31

Reply

Elliot January 3, 2012 at 4:43 pm

Hi,

Great script. Tried to edit so form includes a subject line field. Can anyone help with the PHP?

Thanks

Reply

rufaro January 4, 2012 at 7:14 pm

Hi I am using the pop up form with the captcha but the captcha image is not showing up. everything else works fine but the image isnt showing up when the form pop’s up. what could be the problem?

Reply

John January 21, 2012 at 9:20 pm

Did you resolve this issue? I have the same problem..

Reply

Raph January 7, 2012 at 4:57 pm

hello, how should i do if the a-page.php is not in the same folder??? bcz when i change “require_once(‘popup-contactform.php’)” into “require_once(‘myfoler/popup-contactform.php’)”, “” into “” and “require_once(‘contactform-code.php’)” into “require_once(‘myfolder/contactform-code.php’)”, it doesn’t work!!! what else do i need to change? thanks!

it doesnt work!!! What else do i need to change?

Reply

Joe January 19, 2012 at 6:42 am

Same problem. Did you have any luck figuring it out?

Reply

Tim January 10, 2012 at 3:21 am

I’m trying to get checkboxes to work with this form. I’ve tried giving them each their own name, but they all return true whether they’re checked or not. When I try submitting them as an array, no luck either. I’m obviously new at this…but from my research it looks like I need to insert an ‘isset’ for the boxes, but I can’t figure out where I would do that, if I need to do it. Any luck with checkboxes on this form?

Reply

Ali January 11, 2012 at 9:21 am

Have these issues been solved yet?

Reply

Joe January 20, 2012 at 5:51 pm

Great script! Just wondering if anyone knows if there is a way to get multiple forms going to different emails on the same page?

Ex. page one
Form 1 xxxxxx@yahoo.com
Form 2 xxxxxx@gmail.com

Thanks is advance!

Reply

Nick January 21, 2012 at 1:12 pm

I set up my form, but now I can’t receive the emails that it sends from the form. My email recipient is correct in the file popup-contactform.php. I don’t know what to do??

Reply

John January 21, 2012 at 9:20 pm

Same problem as Rufaro..works but no Captcha image.
Demo works fine and viewing dsource seems to show a very different set of code than that downloaded..

have been testing the non-pop-up version which works fine . I see significant difference in the code that creates the captcha image. Could this be the issue?

Reply

skid January 22, 2012 at 2:29 am

Great contact form.. but how about installation instructions in ENGLISH?

Reply

mark January 29, 2012 at 5:22 pm

Hi
Great script.

I need to send in a new page or pop-up javascript (thank you page), after submit success message (not only the message “Thanks for contacting us. We will get in touch with you soon!”)

Can you help me ?, thanks

Reply

Leave a Comment

Previous post:

Next post: