Link to home
Start Free TrialLog in
Avatar of robyndorn
robyndorn

asked on

HTML Based forms. Responding to user input.

I am designing a css html site and need to include some forms. My experience using forms in a html environment is limited and I am not sure if what I want is possible without venturing out of the html arena. The forms that I will be needing to develop will be in multiple parts and will need to send users to different subsequent forms based on their previous answers. ie, if on form A the user answers yes to question 4 and puts an amount higher than 500 in question 3 then go to form B. Else, go to form C. That kind of thing. At the end of the user filling out all relevant forms the data must then be sent by email.

Could anyone point me in the right direction on the best way to do this? Possibly a tutorial or example that I can look at?
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Hi robyndorn,

There is no way to do what you ask with straight HTML.  You are going to need to pick and learn a scripting language that can store and hold variables and test them with conditional statements after the form is submitted.

The most common choices are:

Perl
PHP
ASP
ColdFusion

and there are multiple tutorials and free scripts available for each one.

I'm not sure how else to help here because you would need to narrow things down to one of the above first.  

i agree, you'll need to do some serverside scripting...

I recommend tutorials at w3schools.

for example, here's their html forms tutorial: http://www.w3schools.com/html/html_forms.asp

and here's their PHP tutorial (which, all things being equal, is my recommendation for your server side language):
http://www.w3schools.com/php/default.asp
I agree that PHP is a good choice if for no other reason than it is pre-installed with most Linux/Apache distributions and has a huge user community that contributes tons of free scripts.
ASKER CERTIFIED SOLUTION
Avatar of fuzzboxer
fuzzboxer

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Fuzzboxer's suggestion is the only choice if you want to avoid a server-side language.  The only problem is that once the forms are all completed, you will need a server-side language to process the data and send it.  

I personally would recommend ASP.NET for this because it has built in functionality to show/hide form elements (or full sections of the page) very easily.  Even more important is that the whole questionnaire can be placed in 1 file, rather than having multiple files to deal with each aspect, which would be the recommended ASP approach.  ASP.NET has a feature called Page State that I don't believe PHP has, whereby the form collection is automatically processed on each submit.  To the layman this means that all the user's choices are automatically remembered each time the page is submitted, which saves TONS of code.

The only thing is you'll need to stop using Dreamweaver as it doesn't support ASP.NET.  Get Microsoft's free Visual Web Developer instead, then take a look at these tutorial videos to see how easy it is:http://www.asp.net/learn/videos/

  -- .NET endorsement over... --
Avatar of robyndorn
robyndorn

ASKER

Thanks everyone. It's gonna take me a little time to go over these suggestions to see which works for me and I'll nominate solutions.
Sorry it's taken me so long to come back to this. I have a couple of questions though.

A concern of mine is if there are any limitations with the suggested options. For instance, some of the decisions to be made will be based on the value of a number that a user inputs, ie:

greater than '500' then do X else do Y .........or
if value for field a + value for field b = greater than x then do Y, else continue,  Before I start learning a code, will any of these codes provide more or less capabilities for me? Any limitations that I should be alerted to?

I guess posting the results to email is a separate issue, so I've included it as a separate question here:
https://www.experts-exchange.com/questions/22876504/Post-web-form-user-inputs-via-email-Advice.html

jason1178: I have some basic experience with PHP, so this would be my best option I guess. Can you elaborate a bit more on how I would use this? Some examples?

basicinstinct: I had a look through the html form pages. I must admit it seemed fairly limited with regards to the intuitive capabilities. Could you note my concerns outlined above and tell me if you think html is still a good option?

fuzzboxer: This sounds like a good option for me as it is more within my comfort zone than some of the options. Can you tell me though, will I run into limitations with this?  Also, Rouchie makes a good point. How would I post the results to email in your opinion?

Rouchie: asp.net is way out of my comfort zone. I've got some basic experience with php though. Also I work on mac... not sure if this is an issue when it comes to Visual web developer. Knowing this, would you still recommend asp.net and MSVWD?

I really appreciate everyone's advice and they are all seeming like viable solutions.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>> Knowing this, would you still recommend asp.net and MSVWD?

No - stick with PHP in your situation.  Jason is certainly the man to help you sort this issue!
"This sounds like a good option for me as it is more within my comfort zone than some of the options. Can you tell me though, will I run into limitations with this?  Also, Rouchie makes a good point. How would I post the results to email in your opinion?"

With my option, I was mainly referring to how you could build the form on one page instead of using PHP to foward everything onto another subform.  However, you would still need to email the results with a scripting language.