homepage Welcome to WebmasterWorld Guest from 54.204.58.87
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
PHP Query Strings help
This is driving me nuts can you help me?
biocell




msg:1303607
 1:49 am on May 7, 2003 (gmt 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]

 

DrDoc




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

you need single quotes around the variable name:

$_GET['action']

biocell




msg:1303609
 2:01 am on May 7, 2003 (gmt 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]

jatar_k




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

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

grifter




msg:1303611
 3:18 am on May 7, 2003 (gmt 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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved