Anthony Ritter wrote:

I'm using the script and no values show up in the page:
session_bb.php

after I submit the values in the <select> form.

If somebody would like to test both scripts (session_aa.php and
session_bb.php) and get back to me I would be grateful.

I think you're using a crappy book... :)


Main PHP part of session_aa.php:
.....................
<?php
if(isset($_POST['form_products']) && is_array($_POST['form_products']))
{
    if(empty($_SESSION['products']))
    { $_SESSION['products'] = array(); }

$_SESSION['products'] = array_unique(array_merge($_SESSION['products'],$_POST['form_products']));

    print "<p>Your products have been registered!</p>";
}
?>

Main PHP part of session_bb.php:
.....................
<?php

if(isset($_SESSION['products']))
{
   print "<b>Your cart:</b><ol>\n";
   foreach($_SESSION['products'] as $p)
   {
       print "<li>$p</li>";
   }
   print "</ol>";
}
?>

Remember to have session_start() on both pages... Also notice, like I said, there's no need to even make a $products array...

Hope that helps.

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to