0

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!!');
?>

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

4 Comments

How do I avoid getting ?email=Blah%40Gmail.com? I can't parse on the receiving end.
The @ has been encoded because it is a special character. $_GET will decode it automatically, you don't have to do anything.
But on the other side it isnt, the parse is taking it down with %40. I know you use urldecode with $_GET but I dont see where.
$_GET automatically passes variables through urldecode. Do not do it manually, as I said you don't have to do anything! See the warning here php.net/manual/en/function.urldecode.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.