My first tutorial here. It is teh very simple. We will be using get. Get is originally for forms (i think :P). But people have used it for other things because it displays the values in the url. Which means you can use the values in the URL as different pages. Just a couple if statements and you have a whole website, all on index.php! :P
So lets get started. I will show you the whole script then break it down into little pieces.:drool:
Okay lets break that down...
Begin the PHP code
$url = $_GET['action']; //get teh thing after action=
We get the value after index.php?action= and put that value into the variable $url
if($url == "admin") {
If that value we put in $url equals "admin", then...
echo "some admin stuff here";
We display the text "some admin stuff here"
}
Lets close the if statement.
if($url == "profile") { echo "some profile stuff here"; } if($url == "logout") { echo "logout teh user"; } if($url == "login") { echo "display teh login form"; }
Lets use that method over and over until we have the desired amount of pages.
else {
If $url doesn't equal any of our set values, then....
echo "You r stupid because i cant find that page";
We display some angry text.
}
Lets close that else statement.
?>
We are now finished with our PHP script :woot:

Help


Actions
Bookmark


Tutorial info
View Members Tutorials







RSS Feed