Hyperlinks......
I have been making websites for about a year now, and I pretty much know HTML inside out. I have recently moved onto working with PHP, and I'm slowly getting the hang of it, however, there is one thing that really puzzles me, the hyperlinks on a lot of PHP websites contain loads of coding, e.g. "www.domain name.com/index.php?type=aboutus" or something similar, you all no what I mean! Anyways, whats that all about, is it something to do with getting data from a MySQL database? I don't mean to sound amateurish but it really puzzles me, and I can't find tutorials on how to make hyperlinks like these or even what there do! Can anyone explain what they do or how they work?
Cheers
kazimmerman posted this at 20:13 — 6th October 2005.
He has: 698 posts
Joined: Jul 2005
When they have a URL with something like '?type=aboutus' on the end, they are probably either using a form (using the GET method), or they are setting the URL to be that and using the variable 'type' to determine what is displayed. Basically what you would do is something like this:
<?
$type = $_GET['type'];
if ($type == "aboutus") {
echo "This is the about us page";
}
if ($type == "something_else") {
echo "This is a different page";
}
?>
Kurtis
Adam678 posted this at 16:00 — 7th October 2005.
They have: 13 posts
Joined: Jul 2005
Instead of it echoing a phrase like "This is the about us page", is there a way to make it display a webpage?
Renegade posted this at 22:18 — 7th October 2005.
He has: 3,022 posts
Joined: Oct 2002
Yes, instead of using the echo() function, use the include() function, have a look on php.net for more information on any of the functions used here.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.