Page 1 of 1

$_GET returns empty always

Posted: Sat Aug 21, 2010 10:08 am
by vjgopinath
Hi All,

I am pretty new to PHP ( I am a C Programmer).

I am trying a simple shopping cart website for my friend.

IN one of the pages, I am submitting some info, which is actually not showing up in my server side php.
Below is the HTML code to submit.

<a href="cart.php?action=add&p=5&size=small"> <img src="images/add_to_cart.gif"/> </a>

I tried to check the values of the parameters using

$action = $_GET['action'] ;

Action stored empty. Then I checked the whole array

print_r($_GET) which returned

Array( )

So, for some reason the value is always empty.
I tried the declaration GLOBAL $_GET, but no use.

Any help/directions - much appreciated!

Thanks!

Re: $_GET returns empty always

Posted: Sat Aug 21, 2010 10:45 am
by PHPHorizons
Hello vjgopinath,

What is the value of the php ini setting for variables_order and arg_separator.input?
What is the value of $_SERVER['QUERY_STRING']?

You can get the php ini settings by running this script:

Code: Select all

<?php
phpinfo();
Cheers

Re: $_GET returns empty always

Posted: Tue Aug 24, 2010 9:19 am
by vjgopinath
Hi PHPHorizons,

Thanks for the prompt reply.

I got the below values by running phpinfo().

Pls advise

variables_order GPCS

arg_separator.input &

_SERVER["QUERY_STRING"] c=3

Re: $_GET returns empty always

Posted: Tue Aug 24, 2010 11:07 am
by PHPHorizons
The variables_order and arg_separator.input look good.
Do you have any idea where that c=3 is coming from? Perhaps the page you are going to is redirecting you to another page?