php-windows Digest 19 Nov 2003 13:45:18 -0000 Issue 2007

Topics (messages 22137 through 22138):

=sessions=  [J. Meloni Textbook]
        22137 by: Anthony Ritter

loading php_gd2.dll
        22138 by: brent

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Using mysql, php, apache on 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
..................

I checked her errata at thickbooks.com but there was nothing for this
chapter.

Any help will be greatly appreciated.
Thank you.
TR
-------------------------------------------

// script 16.4.php

<?php
session_start();
?>
<html>
<head>
<title>Listing 16.4 Storing an array with a session</title>
</head>
<body>
<h1>Product Choice Page</h1>
<?php
if (isset($_POST[form_products])) {
    if (!empty($_SESSION[products])) {
        $products = array_unique(
        array_merge(unserialize($_SESSION[products]),
$_POST[form_products]));
   }
$_SESSION[products] = serialize($products);
print "<p>Your products have been registered!</p>";
}
?>
<form method="POST" action="<?php $_SERVER[PHP_SELF] ?>">
<P>Select some products:<br>
<select name="form_products[]" multiple size=3>
<option>Sonic Screwdriver</option>
<option>Hal 2000</option>
<option>Tardis</option>
<option>ORAC</option>
<option>Transporter bracelet</option>
</select>
<br><br>
<input type="submit" value="choose">
</form>
<br><br>
<a href="listing16.5.php">content page</a>
</body>
</html>
..............


// script 16.5.php
<?
session_start();
?>
<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>
...........

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

--- End Message ---
--- Begin Message --- Hi. I'm having difficulty getting the php_gd2.dll to load.

Running W2K server, IIS 5.0, PHP 4.3.1. I've modified the php.ini file and set my extensions directory to C:\PHP and I've uncommented extension=php_gd2.dll. When I do this, and attempt to load the php test page, my browser attempts to load the page forever, with no success. If I then comment it back out, the page loads, but of course without the dll. I've tried to uncomment and load a couple of other dlls, same result. And those I attempt to load are in the C:\PHP directory where I assume they should be. Anybody have any suggestions?

Thanks.

Brent


--- End Message ---

Reply via email to