homepage Welcome to WebmasterWorld Guest from 54.197.183.230
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Problem with parameters in url with PHP
Everything after the "?" being ignored...
JayC

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 619 posted 8:30 pm on Aug 15, 2002 (gmt 0)

A client has contacted me to say that a simple PHP/MySQL setup on their site no longer works -- and it used to.

I've checked it out, and it seems that the problem is that any parameters in the url, after the question mark, are simply being ignored. The way the thing is written, a .php file displays a list, and the same .php file is called again after a choice has been made, but this time with parameters in the url to express the choice that's been made. So:

www.example.com/view.php

Displays a list. Clicking on a link in that list calls:

www.example.com/view.php?submit=yes&RecordID=1

And the conditional branching within that file should cause it to act differently the second time, because now $submit == "yes". But it doesn't; the html generated is exactly the same as it was when no parameters were present in the url.

This sort of behavior now happens on any of the pages in the site, including a login page in which the parameters should be passed through a form POST.

I didn't write this thing and am pretty much inexperienced with PHP, but it's fairly simple to follow what should be happening... and again, it did work at one time. So is there some configuration change, perhaps, that could affect it? I realize this is probably hard to follow without seeing the site and code in question, but does anyone have any hints?

 

sugarkane

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 619 posted 8:48 pm on Aug 15, 2002 (gmt 0)

A strange one. Try checking whether you can the value of 'submit' using

$submit=$HTTP_GET_VARS['submit'];

If you can do it like that, it appears that your host might have turned off the automatic variable registering (in the PHP configuration file, register_globals = Off )

If that's the case I don't think you can find a way around it other than manually defining all the variables using $HTTP_GET_VARS or $HTTP_POST_VARS

Nick_W

WebmasterWorld Senior Member nick_w us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 619 posted 8:51 pm on Aug 15, 2002 (gmt 0)

Just a hunch, but I reckon the host just upgraded their php engine. Try accessing the url vars with the $_GET['value'] array instead of just $value

Nick

jatar_k

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



 
Msg#: 619 posted 8:51 pm on Aug 15, 2002 (gmt 0)

It sort of sounds like the site was programmed with register_globals [php.net] on and then someone turned it off or upgraded.

JayC

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 619 posted 9:11 pm on Aug 15, 2002 (gmt 0)

Nick_W:
Just a hunch, but I reckon the host just upgraded their php engine. Try accessing the url vars with the $_GET['value'] array instead of just $value

I don't know whether there actually was an upgrade or if there was another reason for the change, but this did the trick. Thanks Nick, and everyone, for the quick help.

So now I have an excuse to go through every line of this thing to find everywhere else this comes into play.

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