1

I am using this code to send just one variable:

Variable:

  1. Username

    header("Location: ultrapro.php?username=".$_POST['username']);

If I want to send more then one variable like:

  1. Username
  2. Password
  3. Phone

---Code----------?

2

4 Answers 4

1

It's a bad idea to send your username and password through a GET request. Don't do it.

If you really must, then use http_build_query():

$query = array(
    'username' => $_POST['username'], 
    'password' => $_POST['password'],
    'phone' => $_POST['phone']
    );

$query = http_build_query($query);
header("Location: ultrapro.php?$query");
Sign up to request clarification or add additional context in comments.

2 Comments

Its just a option i have given
@RedSun: must have been due to the stray dot. I've removed it -- try again. Protip: instead of saying not working, you should try to find out why it's not working. Adding ini_set('display_errors',1); error_reporting(E_ALL); to the very top of your script might help with debugging :)
0

You may use & ..

header("Location: ultrapro.php?username=me&password=dontknow&phone=09090909");

Comments

0

header("Location: " . $username . "?password=" . $pass . "&phone=" . $phone);

1 Comment

Please stop putting spam links into your answers that have no connection to the answer. If you want to advertise your website, do that on your user profile. Thanks.
0

Use & to concatenate the parameters:

 header("Location: ultrapro.php?var1=".$_GET['var1']."&var2=".$_GET['var2']."&var3=".$_GET['var3']);

1 Comment

You could avoid wrong quotations by properly formatting the code.. (remove ." at the end)

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.