Forum Moderators: coopster

Message Too Old, No Replies

Php and url

         

Pera

4:11 am on Feb 7, 2007 (gmt 0)

10+ Year Member



I am trying to pass an id with?string=string within my url so I can query off that information. The problem is that it is working within my production machine which uses Unix, but not my test machine which uses Windows. Do I need to set or add something to the httpd.conf file? I'm using Apache 1.3.33, PHP 4.3.10, MySQL 4.19 and PhpMyAdmin 2.6.1. My test machine is setup as localhost. Help!

mcavic

4:13 am on Feb 7, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How are you reading the value? You should be using $_GET['string'] or $_REQUEST['string'] but not $string.

mcibor

8:41 am on Feb 7, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Pera and welcome to WebmasterWorld!

Try not to use $_REQUEST at all, as it may be easily modified.
Also turn register globals [de3.php.net] off, as they pose a high security breach

So in this example use $_GET['string'] as mcavic suggested

Regards
Michal

Pera

1:14 pm on Feb 7, 2007 (gmt 0)

10+ Year Member



I'm putting a value in my url line using the?string=string (http://localhost.test.php?articlenum=17), so I can query off of it. I use the isset() and!empty() in an IF statement before I run my query. For some reason it is not working on my test machine. How can I test to see if the value is there? It is my id for my article, so I can display it based on the user selection. Like I mentioned, it worked in production and not in my test environment which is weird. That is why I think I need to modify the config file for some reason.

cmarshall

1:18 pm on Feb 7, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



isset($_GET['variable_name']) always works for me, but I use LAMP systems for all my Web work.

whoisgregg

5:36 pm on Feb 7, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Add this to the beginning of your script to see what is being sent to the script:

print_r($_GET);