Form Validation Mulitpage question - Please help me!!!
Posted: Sat Jul 25, 2009 11:32 am
Hello -
I am new to PHP and I am building a muliti-page form. I'm having issues validating my form and submitting variables to the next page.
I am getting an error when it the form tries to validate - Notice: Undefined index: q01 on line 17
I have two questions:
1. How do I validate and send these vars to the next page?
2. The next form is called form02.php. Do I put that in the form action call?
ie. <form name="form1" method="post" action="form02.php">
Any help would be great!
Here is my example --->
<?PHP
// start session
session_start();
// check if radio button is selected after submit
if(isset($_POST['submit'])) {
if (!$_POST['q01'])
echo "Question 1 is required";
} else {
?>
<form name="form1" method="post">
Question One:
<input type="radio" name="q01" value="No" />No
<input type="radio" name="q01" value="Yes" />Yes
<input type="radio" name="q01" value="Maybe" />Maybe
<input type="submit" name="submit"value="Send">
</form>
<?php }
?>
I am new to PHP and I am building a muliti-page form. I'm having issues validating my form and submitting variables to the next page.
I am getting an error when it the form tries to validate - Notice: Undefined index: q01 on line 17
I have two questions:
1. How do I validate and send these vars to the next page?
2. The next form is called form02.php. Do I put that in the form action call?
ie. <form name="form1" method="post" action="form02.php">
Any help would be great!
Here is my example --->
<?PHP
// start session
session_start();
// check if radio button is selected after submit
if(isset($_POST['submit'])) {
if (!$_POST['q01'])
echo "Question 1 is required";
} else {
?>
<form name="form1" method="post">
Question One:
<input type="radio" name="q01" value="No" />No
<input type="radio" name="q01" value="Yes" />Yes
<input type="radio" name="q01" value="Maybe" />Maybe
<input type="submit" name="submit"value="Send">
</form>
<?php }
?>