Script works on one server and not another...

Script works on one server and not another...

am 16.11.2007 14:40:45 von pvanbuskirk

I have the following multipage example script I am practicing with that
came from the php cookbook. It works great on my other business's web
server, but when I upload it here at this job, it goes to a blank page
after clicking "next" on "stage 1". Sounds like a php.ini setting, but
I cannot figure out which one.

// Turn on sessions
session_start();

// Figure out what stage to use
if (($_SERVER['REQUEST_METHOD'] == 'GET') || (! =
isset($_POST['stage'])))
{
$stage =3D 1;
} else {
$stage - (int) $_POST['stage'];
}

// Save any submitted data
if ($stage > 1) {
foreach ($_POST as $key =3D> $value) {
$_SESSION[$key] =3D $value;
}
}

if ($stage == 1) { ?>

' method=3D'post'>

Name:

Age:


?>'/>





' method=3D'post'>
Favorite Color:

Favorite Food:


?>'/>





Hello .
You are years old.
Your favorite color is
and your favorite food is .



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

Re: Script works on one server and not another...

am 16.11.2007 19:55:19 von Zachary Krakov

Hello Patricia,
I figured out your problem... you had a hidden white-space character
in your code that couldn't be parsed by PHP... specifically, on line
24, between the "age:" text element and form element. I have removed
that pesky little white-space character, and your code appears to be
working fine... code pasted below...

// Turn on sessions
session_start();

// Figure out what stage to use
if (($_SERVER['REQUEST_METHOD'] == 'GET') || (! isset($_POST['stage'])))
{
$stage = 1;
} else {
$stage - (int) $_POST['stage'];
}

// Save any submitted data
if ($stage > 1) {
foreach ($_POST as $key => $value) {
$_SESSION[$key] = $value;
}
}

if ($stage == 1) { ?>

' method='post'>

Name:

Age:








' method='post'>
Favorite Color:

Favorite Food:








Hello .
You are years old.
Your favorite color is
and your favorite food is .



Cheers!
-Zak


On Nov 16, 2007, at 5:40 AM, VanBuskirk, Patricia wrote:

I have the following multipage example script I am practicing with that
came from the php cookbook. It works great on my other business's web
server, but when I upload it here at this job, it goes to a blank page
after clicking "next" on "stage 1". Sounds like a php.ini setting, but
I cannot figure out which one.

// Turn on sessions
session_start();

// Figure out what stage to use
if (($_SERVER['REQUEST_METHOD'] == 'GET') || (! isset($_POST['stage'])))
{
$stage = 1;
} else {
$stage - (int) $_POST['stage'];
}

// Save any submitted data
if ($stage > 1) {
foreach ($_POST as $key => $value) {
$_SESSION[$key] = $value;
}
}

if ($stage == 1) { ?>
' method='post'>

Name:

Age:








' method='post'>
Favorite Color:

Favorite Food:








Hello .
You are years old.
Your favorite color is
and your favorite food is .



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

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