Re: [PHP] Nested IF's (Is there a LIMIT ?)
I am too lazy to count your braces for you, but no, there's not really a limit to how many ifs you can nest. It helps to use an editor that flashes the bracket's companion when you type or edit one. That way you can easily see whether they're balanced in the right place. miguel On Fri, 14 Jun 2002, Daniel Negron/KBE wrote: This is my code, it seems that either I have the curly brackets in the wrong place OR there is a limit to how many times you can set IF's. So before I pull out the shotgun, and take out this machine, I figure I would ask the Cousel Of the PHP OverLords. So you know, I happen to also be using validateEmailFormat that was suggested a few minutes ago by Manuel... Thanx by the way, you saved me some time. I also chage the permissions on the files on the server to 777 so there would be no mistake. I also changed the order of the IF statements for the validateEmail class. I have run it both ways with the same result. TIA ? include config.php; include form_validator.class; include validateEmailFormat.php; if ($submit) { if ($form_complete) { $my_form = new form_validator; if($my_form -validate_fields(first, last, email, company, address, city, state, zip, phone)) { $isValid = validateEmailFormat($email); if(!$isValid) { echo Your Email Address Is InValid, \n Please Press your Web Browsers 'BACK' button and re-enter your email address; }else{ $db = mysql_connect($dbhost,$dbuname,$dbpass); mysql_select_db($dbname,$db); $sql = INSERT INTO $prefix; $sql .= (first, last, email, company, address, city, state, zip, phone, fax, mobile, comments); $sql .= VALUES; $sql .= ('$first', '$last', '$email', '$company', '$address', '$city', '$state', '$zip', '$phone', '$fax', '$mobile', '$comments'); $result = mysql_query($sql); if (!$result) {echo(error: . mysql_error() . \n$sql\n);} echo bThank You/b for your submission.bOne of our agents will review your submission and forward your username and password.\n; echo You will not receive this email instantly\n; }else{ echo ($my_form-error_message . brbr); } } } } else { ? HTML FORM html code in here, /FORM /HTML ? } ? Thank You Daniel Negrón Lotus Notes Administrator / Developer KB Electronics, Inc. 954.346.4900x122 http://www.kbelectronics.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Nested IF's (Is there a LIMIT ?)
Bracketing looks good try pulling chunks of code out and gradually add it in to see where the problem lies eg (sorry for reformatting your code) ? include config.php; include form_validator.class; include validateEmailFormat.php; if ($submit) { echo ok } else { ? HTML FORM html code in here, /FORM /HTML ? } ? then ? include config.php; include form_validator.class; include validateEmailFormat.php; if ($submit) { if ($form_complete) { echo ok } } else { ? HTML FORM html code in here, /FORM /HTML ? } ? etc.. -Original Message- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: Friday, June 14, 2002 4:53 PM To: Daniel Negron/KBE Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Nested IF's (Is there a LIMIT ?) I am too lazy to count your braces for you, but no, there's not really a limit to how many ifs you can nest. It helps to use an editor that flashes the bracket's companion when you type or edit one. That way you can easily see whether they're balanced in the right place. miguel On Fri, 14 Jun 2002, Daniel Negron/KBE wrote: This is my code, it seems that either I have the curly brackets in the wrong place OR there is a limit to how many times you can set IF's. So before I pull out the shotgun, and take out this machine, I figure I would ask the Cousel Of the PHP OverLords. So you know, I happen to also be using validateEmailFormat that was suggested a few minutes ago by Manuel... Thanx by the way, you saved me some time. I also chage the permissions on the files on the server to 777 so there would be no mistake. I also changed the order of the IF statements for the validateEmail class. I have run it both ways with the same result. TIA ? include config.php; include form_validator.class; include validateEmailFormat.php; if ($submit) { if ($form_complete) { $my_form = new form_validator; if($my_form -validate_fields(first, last, email, company, address, city, state, zip, phone)) { $isValid = validateEmailFormat($email); if(!$isValid) { echo Your Email Address Is InValid, \n Please Press your Web Browsers 'BACK' button and re-enter your email address; }else{ $db = mysql_connect($dbhost,$dbuname,$dbpass); mysql_select_db($dbname,$db); $sql = INSERT INTO $prefix; $sql .= (first, last, email, company, address, city, state, zip, phone, fax, mobile, comments); $sql .= VALUES; $sql .= ('$first', '$last', '$email', '$company', '$address', '$city', '$state', '$zip', '$phone', '$fax', '$mobile', '$comments'); $result = mysql_query($sql); if (!$result) {echo(error: . mysql_error() . \n$sql\n);} echo bThank You/b for your submission.bOne of our agents will review your submission and forward your username and password.\n; echo You will not receive this email instantly\n; }else{ echo ($my_form-error_message . brbr); } } } } else { ? HTML FORM html code in here, /FORM /HTML ? } ? Thank You Daniel Negrón Lotus Notes Administrator / Developer KB Electronics, Inc. 954.346.4900x122 http://www.kbelectronics.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nested IF's (Is there a LIMIT ?)
I am too lazy to count your braces for you, but no, there's not really a limit to how many ifs you can nest. It helps to use an editor that flashes the bracket's companion when you type or edit one. That way you can easily see whether they're balanced in the right place. »»» Do you happen to have the name of an editor that does that ? I am using dreamweaverMX and UltraEdit, also have EditPlus and TextPad.just is case it was one of them. Thank You Daniel Negrón Lotus Notes Administrator / Developer KB Electronics, Inc. 954.346.4900x122 http://www.kbelectronics.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Nested IF's (Is there a LIMIT ?) SOLVED
I re-arranged the order of IF execution all together. Email Validation First then Form Validation. Thanx Martin and Miguel for your responses. Finally going to bed, have to be up in 3 hours. Thank You Daniel Negrón Lotus Notes Administrator / Developer KB Electronics, Inc. 954.346.4900x122 http://www.kbelectronics.com Martin Towell martin.towell@ To: Daniel Negron/KBE [EMAIL PROTECTED] world.netcc: [EMAIL PROTECTED] Subject: RE: [PHP] Nested IF's (Is there a LIMIT ?) 06/14/2002 02:56 AM Bracketing looks good try pulling chunks of code out and gradually add it in to see where the problem lies eg (sorry for reformatting your code) ? include config.php; include form_validator.class; include validateEmailFormat.php; if ($submit) { echo ok } else { ? HTML FORM html code in here, /FORM /HTML ? } ? then ? include config.php; include form_validator.class; include validateEmailFormat.php; if ($submit) { if ($form_complete) { echo ok } } else { ? HTML FORM html code in here, /FORM /HTML ? } ? etc.. -Original Message- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: Friday, June 14, 2002 4:53 PM To: Daniel Negron/KBE Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Nested IF's (Is there a LIMIT ?) I am too lazy to count your braces for you, but no, there's not really a limit to how many ifs you can nest. It helps to use an editor that flashes the bracket's companion when you type or edit one. That way you can easily see whether they're balanced in the right place. miguel On Fri, 14 Jun 2002, Daniel Negron/KBE wrote: This is my code, it seems that either I have the curly brackets in the wrong place OR there is a limit to how many times you can set IF's. So before I pull out the shotgun, and take out this machine, I figure I would ask the Cousel Of the PHP OverLords. So you know, I happen to also be using validateEmailFormat that was suggested a few minutes ago by Manuel... Thanx by the way, you saved me some time. I also chage the permissions on the files on the server to 777 so there would be no mistake. I also changed the order of the IF statements for the validateEmail class. I have run it both ways with the same result. TIA ? include config.php; include form_validator.class; include validateEmailFormat.php; if ($submit) { if ($form_complete) { $my_form = new form_validator; if($my_form -validate_fields(first, last, email, company, address, city, state, zip, phone)) { $isValid = validateEmailFormat($email); if(!$isValid) { echo Your Email Address Is InValid, \n Please Press your Web Browsers 'BACK' button and re-enter your email address; }else{ $db = mysql_connect($dbhost,$dbuname,$dbpass); mysql_select_db($dbname,$db); $sql = INSERT INTO $prefix; $sql .= (first, last, email, company, address, city, state, zip, phone, fax, mobile, comments); $sql .= VALUES; $sql .= ('$first', '$last', '$email', '$company', '$address', '$city', '$state', '$zip', '$phone', '$fax', '$mobile', '$comments'); $result = mysql_query($sql); if (!$result) {echo(error: . mysql_error() . \n$sql\n);} echo bThank You/b for your submission.bOne of our agents will review your submission and forward your username and password.\n; echo You will not receive this email instantly\n; }else{ echo ($my_form-error_message . brbr); } } } } else { ? HTML FORM html code in here, /FORM /HTML ? } ? Thank You Daniel Negrón Lotus Notes Administrator / Developer KB Electronics, Inc. 954.346.4900x122 http://www.kbelectronics.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit
Re: [PHP] Nested IF's (Is there a LIMIT ?)
Maguma Studio for PHP Light will do the job. Neil Daniel Negron/KBE wrote: ** This Message Was Virus Checked With : SAVI 3.58 May 2002 Last Updated 11th June 2002 ** I am too lazy to count your braces for you, but no, there's not really a limit to how many ifs you can nest. It helps to use an editor that flashes the bracket's companion when you type or edit one. That way you can easily see whether they're balanced in the right place. »»» Do you happen to have the name of an editor that does that ? I am using dreamweaverMX and UltraEdit, also have EditPlus and TextPad.just is case it was one of them. Thank You Daniel Negrón Lotus Notes Administrator / Developer KB Electronics, Inc. 954.346.4900x122 http://www.kbelectronics.com -- Work: [EMAIL PROTECTED] Home: [EMAIL PROTECTED] Web: www.curvedvision.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php