hey all

i am stuck with this problem while i am trying to make a software.

here i have a form that has to be filled by the user. form1, form2, form3 and form4.
In form2 there are two radio button 'yes' and 'no'. So when the user selects yes and clicks on submit buttom he is directed to form3. once the form 3 is filled it directs to form4.

but if he selects no and clicks submit he is directly directed to form4 escaping form3.

how do i do this????? how to take the value of the radiobuttons in the string ???????

Also each questions are saved in the databae using mysql. form1's answers storing codes are written on form2 and from 2's are written on form3 and form3's on form4.

So how do i ensure that either its yes or no form 2 must be entered into the databse....

plz help
Neha

hi neha,
try like this i didn`t try it but this is only my suggession
pass some value to yes radiobox and if that value sets then goto form3 else form4 like this

if(isset($_post(id)))
	echo '<script language="javascript">window.location.href="form3.php?msg=sts"</script>';
else
	echo '<script language="javascript">window.location.href="form4.php?msg=sts"</script>';

Here is a simple example.

<?php
	if(isset($_POST['submit'])) {
			if(isset($_POST['option'])) {
			$option = $_POST['option'];
			if($option == "yes") {
				//insert or update or do whatever you want with the posted values
				header("location: page3.php");
			} else {
				header("location: page4.php");
			}
		} else {
			echo "You didn't select an option!";
		}
	}
?>
<html>
<body>
<form method="post" action="page1.php">
<input type="radio" name="option" value="yes"> Yes <br />
<input type="radio" name="option" value="no"> No <br />
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>

Submit the page to itself and then take relevant action.

It is called redirect, not a new window, please read the thred above carefully, before giving any answer/example. Thanks

Comments
Thanks for this worthless input on a 2-year-old thread.
You bumped an old dead thread for this ?

It is called redirect, not a new window, please read the thred above carefully, before giving any answer/example. Thanks

wow your scolding a MODERATOR? what a brave thing

The thing is that we can create an array with 4 elements (for ach form "yes/no" radio) stored in $_SESSION. Say the user clicked "yes" on 1-st form... the first element will become "1", and so on. Doing the needed stuff according to array elements.

This article has been dead for over six months. Start a new discussion instead.