sequential forms and skipping steps

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
fcarpio
Forum Newbie
Posts: 4
Joined: Thu Mar 03, 2011 10:41 am

sequential forms and skipping steps

Post by fcarpio »

Hello,
I am sorta new to PHP and I have hit a brick wall in the design of an app I am working on. This is the situation, I have a sequence of forms that request some information from the user. At one point I have a for in the road where it goes to BIO, CHEM, RAD or STD. For BIO and CHEM I need to get additional information, for RAD and STD I need to skip the additional information. something like this:

<Page 1>
radio btn BIO
radio btn CHEM
radio btn RAD
radio btn STD
btn Next
</Page 1>

<Page 2>
Have a switch case to display each form depending whether my user selected BIO, CHEM, RAD or STD. But how do I skip RAD and STD and go on to the next page while carrying the type (BIO, CHEM, RAD or STD) information?
</Page 2>

:idea:

It think it just hit me. I was using a single page to handle all the situations but I think I am going to have each option on page 1 go to different pages. The only thing I am not too crazy about is that each option will be a <form> and I would have to have 4 buttons.

Any ideas to make this better?

BTW, hi! I am new here.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: sequential forms and skipping steps

Post by social_experiment »

fcarpio wrote:But how do I skip RAD and STD and go on to the next page while carrying the type (BIO, CHEM, RAD or STD) information?
Do you want to ignore any 'input' (or choice) that is RAD or STD? You have the right idea with switch

Code: Select all

<?php
 switch($option) {
  case('BIO'):
  //do something
  break;
  case('CHEM'):
  // do something
  break;
  default:
  // do someting else
 }
?>
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply