Need an instant quote web form that instantly calculates quotes!
April 1, 2009 12:01 PM   Subscribe

Does anyone know of a php script that can be used to easily generate a web form, and that can have a "calculation" box at the bottom, that will calculate a cost based on the previous response fields?

I'm looking to have a quote form on my site that can instantly give visitors a quote for my services!
posted by thewibbler to Computers & Internet (5 answers total)
 
The calculation box at the bottom would be JavaScript, and there are plenty of resources for that--the form itself isn't PHP, so it's just basic form fields.

That is to say, you might be able to find an online form generator that will write the form's HTML for you, but that wouldn't need to be in PHP. On the backend, you'd need a PHP script to process the incoming form results.

This is pretty easily accomplished, but you just need to look for two separate things: one is a basic PHP contact form--it'll be easy to modify. The other is for a JavaScript calculation field.

MeMail me if you need a bit more help getting that to work; it's really relatively simple though, but if you're not familiar with HTML/JS/PHP, it can be a bit of a pain.
posted by disillusioned at 12:06 PM on April 1, 2009


Forgive me if my understanding of PHP isn't exactly correct, but I am not sure PHP can do on the fly calculations like this. It generates the HTML code and it's done. I could most certainly be wrong.

I think Javascript may be more along the lines of something that will do the trick for you. However, I can't offer anything of real use as my javascript skills are no good.
posted by Brettus at 12:07 PM on April 1, 2009


Either post the form and have PHP generate an updaed form, with the calculated costs, or calculate teh costs in javascript to prevent a round-trip to the server.

I don't know of any particular script, but then, you'd have to modify any exosting script to put in your services and costs (or grab both from a database or a config file), so you'll probably have to write this yourself or hire someone to write it.
posted by orthogonality at 12:12 PM on April 1, 2009


A quote for your web development services, perhaps?

Have you tried googling how to do basic math in javascript or php? It's actually pretty easy, just make a few arrays of whatever service for drop downs, then cost for each... you might want to check out the tutorials for forms here.
posted by shownomercy at 12:17 PM on April 1, 2009


Unless you are recording these quotes are otherwise processing them in the back-end (e.g. emailing them, etc) I'd stick with Javascript for this.

The most basic difference between JS and PHP is that PHP is executed as the page loads. To do any math like calculations you'll either have to push data to a new page, reload your current page, use an iframe...something like that. Javascript is executable without need a loading page.

Javascript math and simple form manipulation is pretty easy. You'll need a basic understanding of creating a function, the onclick event to execute said functions, some JS variable math, and a smidge of JS from element manipulation.

Hope those links point you in the right direction. I'm sure you can find some pre-boxed solution, but working it out yourself can be pretty satisfying.
posted by Gainesvillain at 1:39 PM on April 1, 2009


« Older What are your favorite at-home test kits which...   |   Boston. Bedbugs. Do not want. Newer »
This thread is closed to new comments.