I wanna know how set variable on the Index.php file
eg: when user click to login
it should display like this
anywebsite.org/index.php?action=login
profile link
anywebsite.com/index.php?action=profile
search
anywebsite.com/index.php?action=search
how to write like that
set variable on the Index
Started by bonty89, Mar 01 2010 05:04 AM
2 replies to this topic
#1
Posted 01 March 2010 - 05:04 AM
|
|
|
#2
Posted 01 March 2010 - 08:19 AM
There are a LOT of ways, all based on the HTML you are running. The simplest is to include that in your anchor.
#3
Posted 01 March 2010 - 10:10 AM
Not sure if I understood you well, but if you're talking about GET variables:
An example of setting a GET variable through url is as you said:
anywebsite.com/index.php?action=profile
which sets the GET variable 'action' equal to 'profile', which results in an equal code to:
In general it would be:
anypage.php?variable_name=variable_value
So say you want to set the action variable for your index, you could have a link like:
index.php?action=action_name
and a code like:
Hope this is what you meant and if you've got any questions let me know.
Also, if this is what you're talking about, then I'd advice you to have a look at my tutorial about GET Variables - setting variables through url.
An example of setting a GET variable through url is as you said:
anywebsite.com/index.php?action=profile
which sets the GET variable 'action' equal to 'profile', which results in an equal code to:
$_GET['action'] = "profile";
In general it would be:
anypage.php?variable_name=variable_value
So say you want to set the action variable for your index, you could have a link like:
index.php?action=action_name
and a code like:
<?php $action = $_GET['action']; //puts the action requested through url into $action variable echo htmlspecialchars($action); //outputs the action requested ?>
Hope this is what you meant and if you've got any questions let me know.
Also, if this is what you're talking about, then I'd advice you to have a look at my tutorial about GET Variables - setting variables through url.


Sign In
Create Account

Back to top









