code in login page is:

header("Location: index.php?$page");

how do i get the data from the variable in index page after redirect from login page

Recommended Answers

All 3 Replies

code in login page is:

header("Location: index.php?$page");

how do i get the data from the variable in index page after redirect from login page

You mean the $page value? Or some other variable? If you mean $page (which I assume is a name-value pair like "var=someValue", if not then you aren't sending it correctly) then in index.php you can read it from the request as $var=$_GET['var']; If this is not what you are asking about, please reply with a little bit more detail on the question.

there is this code

$var1='done'
header("Location: index.php?$var1");

and now want to pass the value in the variable $var1 and store it in another variable in index page

there is this code

$var1='done'
header("Location: index.php?$var1");

and now want to pass the value in the variable $var1 and store it in another variable in index page

Ok, to do that you will need to change your redirect url a little bit. Variables are passed with a name and a value, so you would send it like so:

header("Location: index.php?var1=$var1");

In your index page, you retrieve it from the request like this

$var1 = $_GET['var1'];
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.