Welcome to WebmasterWorld Guest from 54.166.245.10

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP Query Strings help

This is driving me nuts can you help me?

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

New User

10+ Year Member

joined:Feb 23, 2003
posts:11
votes: 0


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]

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

Senior Member

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

joined:Mar 15, 2002
posts:6807
votes: 0


you need single quotes around the variable name:

$_GET['action']

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

New User

10+ Year Member

joined:Feb 23, 2003
posts:11
votes: 0


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]

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

Administrator

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

joined:July 24, 2001
posts:15756
votes: 0


have you taken a look at switch [php.net]
3:18 am on May 7, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Jan 7, 2003
posts:106
votes: 0


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
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members