News:

Wondering if this will always be free?  See why free is better.

Main Menu

I need some quick help with php navigation

Started by Rockboy, October 25, 2005, 12:38:09 PM

Previous topic - Next topic

Rockboy

Hey,
I'm creating a web design website, and I'm adding some special discount pages. Instead of linking to pages like 'discount1.php' and so on, I think it would be much more professional (and easy) to do this: 'discounts.php?id=123'. But how do I do that? If anyone knows of a tuturial on how to do that, please let me know. Thanks!

-John

kegobeer

Basically, you do something like this in discount.php:

$discount = $_GET['id];
if ($discount == 1) {
  ...stuff...
}


Of course, you want to sanitize the variable and make sure you only get what you're looking for.  I don't know of any tutorials, but you can start here:

http://www.php.net/variables.predefined

If you take a look at SMF's code, you will see many, many examples of how to grab variables from the URL.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

Advertisement: