Creating a form with multiple choices and outcomes?

mpbiz

New member
Apr 29, 2010
2,825
57
0
I need to create a form with lets say 3 questions.

Question 1. Would you like to work with your hands?

Question 2. Would you like to work in an office?

Question 3. Would you like to work as a cop?

If the user checks the box next to questions 1 and 2, but not 3, then once they click submit the page will generate links to 2 CPA offers: one for manual labor jobs and one for office jobs since they checked the yes box for questions 1 and 2.

I basically want to be able to generate the cpa offer results based on how the user answers/checks the different parts of the form.

If I could accomplish the above with some type of easy to use form generator that would be perfect.

Any recommendations?
 


Form stack and wufoo may have some kind of built in functionality because they can handle basic logic pretty well. If you want to get exactly what you need its always better to have someone just code it for you...
 
Code:
<p>Question 1. Would you like to work with your hands?
<p>
    <input type="radio" name="opt1" value="yes" /> yes 
    <input type="radio" name="opt1" value="no" /> no
</p>
<p>Question 2. Would you like to work in an office?</p>
<p>
    <input type="radio" name="opt2" value="yes" /> yes 
    <input type="radio" name="opt2" value="no" /> no
</p>

<p>Question 3. Would you like to work as a cop?</p>
<p>
    <input type="radio" name="opt3" value="yes" /> yes 
    <input type="radio" name="opt3" value="no" /> no
</p>
then in php:

Code:
$o1 = $_POST['opt1'];
$o2 = $_POST['opt2'];
$o3 = $_POST['opt3'];

if($o1 == 'yes' && $o2 == 'yes' && $o3 == 'no') { doSomething(); }
 
  • Like
Reactions: mpbiz
Houdas is correct for a PHP solution. You need a submit button there somewhere and a form though.

Another solution would be with jQuery. Once the user submits then, the form div hides and shows a div with the CPA offers. All 3 could be on the page and hidden since it's so light. Just show the ones relevant to the check box.
 
  • Like
Reactions: mpbiz
Code:
<p>Question 1. Would you like to work with your hands?
<p>
    <input type="radio" name="opt1" value="yes" /> yes 
    <input type="radio" name="opt1" value="no" /> no
</p>
<p>Question 2. Would you like to work in an office?</p>
<p>
    <input type="radio" name="opt2" value="yes" /> yes 
    <input type="radio" name="opt2" value="no" /> no
</p>

<p>Question 3. Would you like to work as a cop?</p>
<p>
    <input type="radio" name="opt3" value="yes" /> yes 
    <input type="radio" name="opt3" value="no" /> no
</p>
then in php:

Code:
$o1 = $_POST['opt1'];
$o2 = $_POST['opt2'];
$o3 = $_POST['opt3'];

if($o1 == 'yes' && $o2 == 'yes' && $o3 == 'no') { doSomething(); }

Houdas is correct for a PHP solution. You need a submit button there somewhere and a form though.

Another solution would be with jQuery. Once the user submits then, the form div hides and shows a div with the CPA offers. All 3 could be on the page and hidden since it's so light. Just show the ones relevant to the check box.

+rep thank you.
 
I just built a rather complex solution that asks the user an arbitrary number of questions, then sends them down the best -- auto-optimized -- path depending on what they've responded. Then my client stiffed and didn't pay, so the code is sitting untouched.

If you have any interest in a more robust solution that will maximize your RPU, PM me. Make me happy with monies and I will make you happy with code.
 
Check out appnitro or gravityforms for WP. Also if you want something hosted try wufoo,formstack or any of those types of services.