[FX.php List] Multiple Page Forms: Unsetting submit button
Jonathan Schwartz
jonathan at eschwartz.com
Wed Jul 19 23:27:03 MDT 2006
DC,
Thanks for your comments and suggestions. The validation could
clearly be better.
J
At 9:38 PM -0400 7/19/06, DC wrote:
>since ereg() is case sensitive you will need to modify your regular
>expression to include capital letters.
>
>i like preg_match() better than ereg() since it is said to be faster
>and is more flexible with the ability to do case insensitive
>switches, etc...
>
>also, the reg exp itself could be better for email detection. see
>this site/page for a great example and tutorials:
>
>http://www.regular-expressions.info/email.html
>
>good to see progress!
>dan
>
>On Jul 19, 2006, at 8:39 PM, Jonathan Schwartz wrote:
>
>>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
>>
>>_______________________________________________
>>FX.php_List mailing list
>>FX.php_List at mail.iviking.org
>>http://www.iviking.org/mailman/listinfo/fx.php_list
>
>_______________________________________________
>FX.php_List mailing list
>FX.php_List at mail.iviking.org
>http://www.iviking.org/mailman/listinfo/fx.php_list
--
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