[FX.php List] Multiple Page Forms: Unsetting submit button
Jonathan Schwartz
jonathan at eschwartz.com
Wed Jul 19 18:39:29 MDT 2006
Moving ahead slooooooooowly with my multiple page form project...
I am using the code (below) for form validation. The code appears on
the top of the form pages. It uses isset to see if the submit_form
button was set. The problem is now that I have moved to the second
form page, how do I get the "submit_button" to get unset. I did try
unset('submit_button'), but I'm unclear whether this is the right way
to go, and if so, where to put the unset command. I feel that I have
to Unset while on the createrecord.php page, just after a succesfull
record creation before, but before the form2.php is loaded.
The pages go: form1.php-->createrecord.php--->form2.php.
Code from form2.php:
<?
// only validate form when form is submitted
if(isset($_POST['submit_button'])){
$msg='';
if(trim($_POST['Reg1NameFirst'])==''){
$msg.="Please enter a First Name.<br>";
}
if(trim($_POST['Reg1NameLast'])==''){
$msg.="Please enter a Last Name.<br>";
}
/*
if(trim($_POST['Reg1Session1'])==''){
$msg.="Please select a Session.<br>";
}
if(trim($_POST["Contact1Email"])=='') {
$msg.="Please enter an email<br>";
} else {
// check if email is a valid address in this format
username at domain.com
if(!ereg("[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]",
$_POST["Contact1Email"])) $msg.="Please enter a valid email
address<br>";
}
*/
// display error message if any, if not, proceed to other processing
if($msg==''){
include('form3.php');
exit;
} else {
#echo "<font color=red>$msg</font>";
}
}
?>
TIA,
Jonathan
--
Jonathan Schwartz
Schwartz & Company
817 Marin Drive
Mill Valley, CA 94941
Phone: 415-381-1852
jonathan at eschwartz.com - http://www.eschwartz.com
More information about the FX.php_List
mailing list