Forums

multipage form1 or form2

barnfold 25 Sep, 2009
hi

this is an extension of another post i have about a booking form set up.

what i want is for the first form to ask a question.

(drop down box)
are you a member ?
yes
no


if they select yes i want them to goto form1
if they select no i want them to goto form2

am i goign to need an if statement somewhere for this or something on the submit button (in this case a next button) ?

i have this code for it
<div class="form_item">
  <div class="form_element cf_heading">
    <h2 class="cf_text">Booking Form</h2>
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_text"> <span class="cf_text"></span> </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_radiobutton">
    <label class="cf_label" style="width: 150px;">Are you a member?</label>
    <div class="float_left">
      <input value="Yes" title="" class="radio validate-one-required" id="radio00" name="radio0" type="radio" />
      <label for="radio00" class="radio_label">Yes</label>
      <br />
      
<input value="No" title="" class="radio validate-one-required" id="radio01" name="radio0" type="radio" />
      <label for="radio01" class="radio_label">No</label>
      <br />
      

    </div>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_button">
    <input value="Next" name="button_3" type="submit" />
  </div>
  <div class="cfclear"> </div>
</div>


thanks for the great support
GreyHead 25 Sep, 2009
Hi barnold,

Don't think in terms of going to form 1 OR form 2 - using multi-page it's simpler to always go to Form 2 but to have Form 2 show the appropriate inputs using an 'if' or a 'switch'.
<?php 
if ( $posted['radio00'] == 'Yes ) {
?>
// some inputs
<?php 
} else {
?>
// some other inputs
<?php
}
?>

Bob
barnfold 25 Sep, 2009
thanks i guess it would make things much easier..

ill give it a go and see what happens

do they if statements go in the html part or the javascript part of the form code or does it not matter to much ?

regards
GreyHead 25 Sep, 2009
Hi barnfold,

Form HTML (yes it does matter).

Bob
This topic is locked and no more replies can be posted.