Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Passing two variables

In php, how do I pass two variables

10:01 pm on Nov 4, 2003 (gmt 0)

New User

10+ Year Member

joined:July 21, 2003
votes: 0


I have a form that is processed by php, which generates a thank you page to the submitter. It's set so that the thank you page thanks the person by name...which I've done with no problems. However, I also want the referring url to be shown on the thank you page so that the person can click on it and be returned to the page he or she came from.

The form has this code:

$url = getenv("HTTP_REFERER");

at the top and this code

<td><input name="url" value="<?php echo $url? >" type="hidden"></td>

in the body.

The form_proc.php page has this code:

$First_Name = trim($First_Name);
$Last_Name = trim($Last_Name);
$email = trim($email);
$url = trim($url);
$Name = $First_Name . " " . $Last_Name;

foreach($HTTP_POST_VARS as $key => $value)
$message .= $key . ": " . $value;
$message .= "\n";
mail("me@domain.com","Name of Form","$message","From: $Name <$email>");

header ("Location: thanks_cc.php?Name=$Name");

How do I append the $url to the header so that it appears on the thank you page, or is it not possible? I've tried comma, "+", etc., with no luck.

The thank you page is this:

<p>Thank you for your registration, <?php echo $Name?>. </p>

<p>Return to <a href="<?php echo $url?>">the page you came from.</a></p>

It's the Return to that I'm having trouble with. No matter what I do, the name and url just come through as one string.

Thanks for any help!

10:16 pm on Nov 4, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 26, 2003
votes: 0

Have you tried...

header ("Location: thanks_cc.php?Name=$Name&url=$url");



2:10 pm on Nov 5, 2003 (gmt 0)

New User

10+ Year Member

joined:July 21, 2003
votes: 0

Thank you, Jordan. Could have sworn I tried that too but apparently not. That worked.