Page 1 of 1

A newbie and Query Strings

Posted: Thu May 01, 2003 4:20 pm
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

Posted: Thu May 01, 2003 6:41 pm
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.