Jonathan Yates
Jonathan Yates

Reputation: 11

Passing URL query Variable to different Forms

I need to send users from a php form to another, but I need to pass a URL query across too. So they are arriving at example.com/[email protected], then they need to passed to example.com/[email protected]. I can not get it to use $_GET in the '' around the header('Location: http://www.example.com');

See Code


<?php

$email = $_GET["email"];

$_POST['customerSatisfaction'];
    $to = "blah";
    $email_from = 'blah';
    $email_subject = "blah";
    $headers = "From: $email_from \r\n";
    $email_body =   "   <?xml version = \"1.0\"?>
    <?adf version = \"1.0\"?>
        <adf>

            <prospect>
                <customer>

                <email preferredcontact=\"1\">$email</email>

                </customer>

            </prospect>
        </adf>
";
    mail($to,$email_subject,$email_body,$headers);
    header('Location: http://www.BLAH.com/NEED $EMAIL HERE!!');
?>

Upvotes: 0

Views: 42

Answers (1)

rjdown
rjdown

Reputation: 9227

What you posted is invalid. Try this:

header('Location: http://www.BLAH.com/?email=' . urlencode($email));

Also it's usually a good idea to add exit; after sending a redirect header.

Upvotes: 2

Related Questions