0

I want to pass a uid to the next page through a query string. How do I pass it and how do I get it on the next page?

hakre
199k55 gold badges453 silver badges865 bronze badges
asked Oct 28, 2010 at 10:15
1
  • add some code , of your problem Commented Oct 28, 2010 at 10:16

4 Answers 4

2

i want to pass a uid to next page through querystring.how i pass it and how i get it on next page?

You can create a link like this:

<a href="page.php?var=value">Go</a>

The variable-value pair after ? will create the query string. Later you can get the query string with $_GET array like $_GET['var'] for example.

answered Oct 28, 2010 at 10:17

Comments

1

You can also pass the value from one page to another page using SESSION.

session_start(); 
$_SESSION['variable name']=$var;

$var is the variable where you store the value that you want to pass to next page and variable name is name of session variable .

In the Next page where you want to fetch.

session_start();
$a=$_SESSION['variable name'];

$a in which you get the value that you store on the previous page.

bish
3,4479 gold badges52 silver badges70 bronze badges
answered Aug 12, 2015 at 9:46

Comments

0

There are several ways to do that:

  1. For links: pass "uid" as GET parameter in all links: <a href='something.php?uid=$uid ... '

  2. For forms: pass "uid" as POST parameter, this can be done with <input type='hidden' name='uid' value='$uid'>

  3. Also, you may use cookies, see the following article for details: http://php.net/manual/en/function.setcookie.php

answered Oct 28, 2010 at 10:21

Comments

0

//if your data is not danger and Sensitive information send like this

$uid="your variable";
header("location:page.php?uid=$uid")

// get like this in another page (page.php)

$uid=$_GET['uid'];

//if your data is Sensitive information like pass use it

$_SESSION['uid']="your variable";
header("location:page.php?uid=$_SESSION['uid']")

// get like this in another page (page.php)

$uid=$_SESSION['uid'];
answered Aug 29, 2021 at 6:45

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.