|
|
Link System in PHP - Tutorial by - Titan (Rob) |
|
|
|
First, we have to setup a basic navigation bar. CODE <div style='float:left; width:40%;'> There, we got our basic navigation. And no it is not a typo, i meant for all three of those links to be the same. This is where things are gonna start getting tricky cause now we gotta start adding the PHP stuff. Now, we gotta add lil pieces to the end of the url's in order for our PHP Link System to work. CODE <a href='page1.php?id=1'> Link Area 1 on Page 1</a><br> Now we have to add our information, this is the msot complicated part. CODE <?php case 2: case 3: default: Now, lemme explain some of this. the $_GET['id'] takes any information in a url after a ? . So, what this is doing is getting the value of the variable id which we defined for each of our links before. Each of the cases in the Switch is equal to one of the values that we have defined on the end of our links. the 'default' is what is displayed when the page is first loaded and no one has clicked on a link. To add more to each case, add an echo "code here" ; for each line you are adding AND MAKE SURE YOU DO NOT DELETE THE " break; " |
|
PS: Tutorial written with the permission of the Author! by - Titan (Rob) |