Web Hosting Talk







View Full Version : Multiple PHP Contact Form in one?


sabian1982
02-06-2006, 10:39 AM
What im looking to do is create a varied mail form on one page using php. What i mean by this is that i want to put a radio button list or drop down menu which has a number of different options (for example: 'general' (default), 'complaint' and 'add link'

The General form (which is displayed by default) has 3 input boxes (name, email, comment). When the drop down menu or radio button is changed to (for example) 'add link' the form changes to display 4 input boxes with different names/inputs (name, email, url, comments).

I'm really no good at php so could someone suggest help me sort this out? its simply so i dont have to have seperate pages for each individual form and dont have to put 2 or 3 different forms on the one page (hence making the page length rather long). Im very limited when it comes to programming however i can gather that the scripting would some how use an if statement to see what dropdown option has been selected... other than that i haven't a clue.

For finished working forum would then go on http://www.dietdebate.co.uk/contactus.php

Help!!!

sabian1982
02-09-2006, 12:33 PM
any suggestions anyone... other than the newbie who said he'd do it for my for 50$

mitchlrm
02-09-2006, 09:07 PM
It is just a matter of looking at which option was chosen and displaying the html form for the option that was chosen.

I suggest you either hire someone who can do it for you or take some time to learn php.

Jatinder
02-09-2006, 10:56 PM
What you want to do is to show/hide form elements based on the radion button (General, Complaint, Add Link) selection. You can do this easily through JavaScript. Set "onClick" handlers on the radio buttons.

PHP can also be used to achieve the same effect but it will be slower than the JavaScript solution since the page will need to be refreshed each time the radio button selection changes. You would be better off just using links rather than this approach.

I would suggest to use JavaScript to show/hide the form elements.

AdvaHost
02-10-2006, 01:45 AM
any suggestions anyone... other than the newbie who said he'd do it for my for 50$

Heh, I don't think so, I just happen to have 5+ years hands on ;) Fifty dollars is pretty cheap for a PHP developer ;) The guys who made WhoisCart charge 185$ an hour.