I pass a variable to domain.com/index.php?user=username
In my page (index.php) contains others pages like about.php, profile.php, contact.php etc..
My question is, is it possible that i pass variable to index.php, then about.php, profile.php can also retrieve the variable using $_GET[‘user’]; method??(actually i tried, its failed, give me “undefined index:…”
If this method failed, is there any other way?
EDIT:
yeah, i can use SESSION. How about I want to display others profile? means other username?
You can save the variable in a session.
In your index.php file.
And then in your following files you can start the session and call
$_SESSION["user"]EDIT:
If you need to display different content that can take the same arguments, then you need to have those arguments in that url.
EDIT 2:
BTW this is sort of guessing since I don’t know your code or skill level.
Lets assume you have this index.php page. Which you access by index.php?user=john
And in this page you list friends of john. And you can access their profile also by doing index.php?user=alex and index.php?user=tim
Then you can reference the url of their friends with. (assuming you have arrays of friends in a standard mysql_fetch_* way)
And fetch your link by using the $_GET variable