passing variable - I think I'm close now!

Thanks very much for your patience, sorry I’m slow to understand.

here’s page1.php
[php]session_start();
$_SESSION[‘name’] = $contactName;
header( “Location: http://wwww.aSite.com/thanksForOrder.php”);
[/php]

here’s thanksForOrder.php
[php]session_start();
echo “Dear $_SESSION[‘name’]”;
[/php]

Here’s the error I’m getting:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /aSite.com/thanksForOrder.php on line 23

I’m guessing it’s something about echo that I’m doing wrong.

Thanks again,
Gerard

Take the single quotes out of the session variable where u echo it.

If this is a one time use of a single variable, why not just send it in the URL?

[php]header(“Location: http://wwww.aSite.com/thanksForOrder.php?contactName=” . urlencode($contactName) . “”);[/php]

[php]echo ‘Dear’ . $_SESSION[‘name’];[/php]

or

[php]echo “Dear {$_SESSION[‘name’]}”[/php]

:wink:

Sponsor our Newsletter | Privacy Policy | Terms of Service