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
There are a LOT of ways, all based on the HTML you are running. The simplest is to include that in your anchor.
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:Code:$_GET['action'] = "profile";
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.Code:<?php
$action = $_GET['action']; //puts the action requested through url into $action variable
echo htmlspecialchars($action); //outputs the action requested
?>
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.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks