Welcome to WebmasterWorld Guest from 54.226.27.104

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP Query Strings help

This is driving me nuts can you help me?

     

biocell

1:49 am on May 7, 2003 (gmt 0)

10+ Year Member



Im try to add query strings to my links but when i do it just refreshes the page this is the code i scripted but can you tell me whats wrong im on my 2nd hour trying to fix this thanks.

Link:

index.php?action=main

and tryed

?action=main

Script:

<?PHP
if($_GET[action] == "main") {
include("index.php");
}

elseif($_GET[action] == "about") {
include("test.php");
}

elseif($_GET[action] == "tutorials") {
include("tuts.php");
}

else {
include("http://www.mysite.com/v2/index.php");
}
?>

[edited by: jatar_k at 1:53 am (utc) on May 7, 2003]
[edit reason] no specifics please [/edit]

DrDoc

1:53 am on May 7, 2003 (gmt 0)

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member



you need single quotes around the variable name:

$_GET['action']

biocell

2:01 am on May 7, 2003 (gmt 0)

10+ Year Member



no still messing up because when i click on the
main
it makes a loop but they get staked on top of eachother they dont open like a normal link would and the other ones just refesh the page

Do you know of one that will work if you do please let me know the one i made is being a pain and im over it dont feel like messing with it anymore

[edited by: jatar_k at 2:17 am (utc) on May 7, 2003]
[edit reason] typo [/edit]

jatar_k

2:19 am on May 7, 2003 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



have you taken a look at switch [php.net]

grifter

3:18 am on May 7, 2003 (gmt 0)

10+ Year Member



index.php is including itself when action=main, which is causing the loop. call it main.php or index2.php or index.inc.php etc etc
 

Featured Threads

Hot Threads This Week

Hot Threads This Month