A newbie and Query Strings

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
axelf
Forum Newbie
Posts: 1
Joined: Thu May 01, 2003 4:20 pm

A newbie and Query Strings

Post by axelf »

ok, ive been to a few php tutorials sites. and all they give me is this:

<?
$HTTP_GET_VARS['tutorials'];
if ($tutorials == "php" || $tutorials == "") {
include("php.php");
}
else if($tutorials == "photoshop") {
include("ps.php");
}
?>

but what do i do??

do i stick it at the top of my page...??? do i make the link go to href="tuts.php=php" or something

if you could give me an easy explanation....it would be greatly appreciated.

thnx
User avatar
Sevengraff
Forum Contributor
Posts: 232
Joined: Thu Apr 25, 2002 9:34 pm
Location: California USA
Contact:

Post by Sevengraff »

the code assumes your using a url something like this:

example.com/script.php?tutorials=php
example.com/script.php?tutorials=photoshop

$HTTP_GET_VARS[] holds variables created in the url.

example.com/script.php?var1=happy&var2=sad&var3=sleepy

notice that after the first variable, you need to use the & to seperate variables.

Yes, you would have to put that code in a php file, and probally have nothing else in that file. make sure that php.php and ps.php are in the same folder as your script.
Post Reply