Anthony Ritter wrote:

Using mysql, apache and win98

The following code is from "PHP, mySQL and Apache" (SAMS) by Julie Meloni.

Page 338-339 (hour 16).

After choosing my selections in the form box and hitting submit I get:
...............

Warning: Invalid argument supplied for foreach() in
c:\apache\htdocs\listing16.5.php on line 13
..................

[ snip ]



// script 16.5.php <html> <head> <title>Listing 16.5 Accessing session variables</title> </head> <body> <h1> Content Page</h1> <?php if (isset($_SESSION[products])) { print "<b>Your cart:</b><ol>\n"; foreach (unserialize($_SESSION[products]) as $p) { print "<li>$p"; } print "</ol>"; } ?> <a href="listing16.4.php">Back to product choice page</a> </body> </html>

you are missing session_start(); on 16.5 You need that in order to populate the $_SESSION array.


--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
-----------------------
"Documentation is like sex: when it is good,
 it is very, very good; and when it is bad,
 it is better than nothing."

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



Reply via email to