$_GET returns empty always

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vjgopinath
Forum Newbie
Posts: 2
Joined: Sat Aug 21, 2010 9:43 am

$_GET returns empty always

Post 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!
User avatar
PHPHorizons
Forum Contributor
Posts: 175
Joined: Mon Sep 14, 2009 11:38 pm

Re: $_GET returns empty always

Post 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
vjgopinath
Forum Newbie
Posts: 2
Joined: Sat Aug 21, 2010 9:43 am

Re: $_GET returns empty always

Post 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
User avatar
PHPHorizons
Forum Contributor
Posts: 175
Joined: Mon Sep 14, 2009 11:38 pm

Re: $_GET returns empty always

Post 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?
Post Reply