Re: SESSIONS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday, January 1, 2015, Stuart Dallas <stuart@xxxxxxxx> wrote:

> Before I look at the code in any sort of detail, what do you mean by "from
> the terminal"?
>
> On Friday, January 2, 2015, Ethan Rosenberg <
> erosenberg@xxxxxxxxxxxxxxxxxxxx <javascript:;>>
> wrote:
>
> > Dear List -
> >
> > My session variables do not seem to propagate....
> >
> > a.php
> >
> > <?php
> >
> > session_name("STORE");
> > session_set_cookie_params( '24000', '/' );
> > session_start();
> > ?>
> >
> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
> > http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> >
> > <snip>
> >
> >             global $cxn;
> >             global $sale;
> >             global $tax_rate;
> >             global $tax;
> >             $upc = $_POST['UPC'];
> >             $_SESSION['UPC'] = $_POST['UPC'];
> > <snip>
> >
> >                 case 'step3':
> >                 {
> > echo 'step3';
> >                     global $cxn;
> >                     global $sale;
> >                     global $tax_rate;
> >                     global $tax;
> >                     $upc = $_POST['UPC'];
> >                     $_SESSION['UPC'] = $_POST['UPC'];
> > echo 'sess';
> > print_r($_SESSION);
> > echo '<br />';
> >                     if(strlen($upc)< 5) // the value is a 4 digit
> >                     //     code, which is used for fruits and vegatables
> >                     {
> >                         $sql7 = "select WeightFlag from Food where PLU =
> > $upc";
> >                         $result7 = mysqli_query($cxn, $sql7);
> >                         $row7 = mysqli_fetch_row($result7);
> >
> >                     }
> > echo 'row7';
> > print_r($row7);
> >                     if($row7[0] != 0)
> >                     {
> >
> >
> >                         echo "<form method= 'post'
> > action='HandleWeight.php'>";
> >                         echo "<center><strong><input type = 'submit'
> > value= 'WEIGH'></strong></center>";
> >                         echo "</form>";
> >                         exit();
> >                     }
> > echo 'SQL11';
> >                     $sql11= "$row[7] IS  NULL OR $row[7] == '' ";
> >                     if($sql11)
> > print_r($_POST);
> > print_r($_SESSION);
> >                     {
> >
> >                         $output = shell_exec('php HandleFood.php');
> >                         echo $output;
> >
> >                     }
> >                     break;
> >
> >                 } //end step3
> > ------------------
> > From the terminal -
> >
> > step3sessArray
> > (
> >     [UPC] => 3127
> > )
> >
> > row7Array
> > (
> >     [0] => 0
> > )
> > SQL11Array
> > (
> >     [UPC] => 3127
> >     [welcome_already_seen] => already_seen
> >     [next_step] => step3
> > )
> > Array
> > (
> >     [UPC] => 3127
> > )
> >
> >
> > --------
> >
> > HandleFood.php
> >
> > <?php
> >                         session_name("STORE");
> >                         session_set_cookie_params( '24000', '/' );
> >                         set_time_limit(2400);
> >                         session_start();
> > ?>
> >
> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
> > http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> >
> > <snip>
> >
> > echo 'sess<br />';
> > print_r($_SESSION);
> >                                         global $cxn;
> >                                         global $sale;
> >                                         global $tax_rate;
> >                                         global $tax;
> >                                         $upc = $_SESSION['UPC'];
> >
> > echo 'ses2<br />';
> > print_r($_SESSION);
> > -----
> > From the terminal --
> >
> > sess
> > Array
> > (
> > )
> > ses2
> > Array
> > (
> > )
> >
> > What am I doing wrong??
> >
> > TIA
> >
> > Ethan
> >
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> --
> -Stuart
>
> --
> Stuart Dallas
> 3ft9 Ltd
> http://3ft9.com/
>


Besides running from the terminal which won't set a session since the
browser controls cookies and stuff

shouldn't session_start go first?

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux