Re: Switch Statement
| From: | Aziz Saleh | Date: | Sun, 29 Sep 2013 02:53:15 +0000 |
| Subject: | Re: Switch Statement | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-322207@lists.php.net to get a copy of this message | ||
Ethan, can you do a var_dump instead of print_r. It might be that next_step
has spaces in it causing the switch to not match.
Aziz
On Sat, Sep 28, 2013 at 10:33 PM, Ethan Rosenberg <
erosenberg@hygeiabiomedical.com> wrote:
> Dear List -
>
> I have a working program. I made one change in a switch statement, and it
> does not work. I'm probably missing something fundamental.
>
> Here are some code SNIPPETS... [please note that all my debug statements
> are at the left margin]
>
> Setup...
>
> <?php
> session_start();
> session_name("STORE");
> set_time_limit(2400);
> ini_set('display_errors', 'on');
> ini_set('display_startup_**errors', 'on');
> error_reporting(-2);
>
> ini_set('error_reporting', 'E_ALL | E_STRICT');
> ini_set('html_errors', 'On');
> ini_set('log_errors', 'On');
> require '/home/ethan/P/wk.inc'; //password file
> $db = "Store";
> $cxn =mysqli_connect($host,$user,$**password,$db);
> if (!$cxn)
> {
> die('Connect Error (' . mysqli_connect_errno() . ') '
> . mysqli_connect_error());
> }// no error
> if($_REQUEST['welcome_already_**seen']!= "already_seen")
>
> show_welcome();
>
> //end setup
> function show_welcome() //this is the input screen
> {
> <snip>
>
> echo " <input type='hidden' name='welcome_already_seen'
> value='already_seen'>";
> echo " <input type='hidden' name='next_step'
> value='step20' />";
>
> <snip>
> }
>
>
> //end input screen
>
> //Switch statement
>
> echo 'before';
> print_r($_POST); //post#1
>
> switch ( $_POST['next_step'] )
> {
>
> case 'step20':
> {
> pint_r($_POST); //post#2
> echo 'step20';
> if(!empty($_POST['Cust_Num']))
> good();
> if(empty($_POST['Cust_Num']))
> bad();
> break;
> } //end step20
>
> <snip>
> } //end switch
>
>
>
> post#1
>
> beforeArray
> (
> [Cust_Num] => 123
> [Fname] =>
> [Lname] =>
> [Street] =>
> [City] =>
> [state] => NY
> [Zip] => 10952
> [PH1] =>
> [PH2] =>
> [PH3] =>
> [Date] =>
> [welcome_already_seen] => already_seen
> [next_step] => step20
>
> )
>
> Cust_Num state and Zip are as entered.
>
> The switch statement is never entered, since post#2 is never displayed,
> and neither good() or bad() functions are entered.
>
>
> TIA
>
> Ethan
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>