Welcome Guest, Not a member yet? Register   Sign In
Not getting Get Variables form Url

I try to get variables from Url which like as follow


and try to print that variables
  echo $data['pid'];
   echo $data['city'];

But I get this error:
A PHP Error was encountered
Severity: Notice

Message: Undefined index: City

Filename: controllers/Offer.php

Line Number: 15

A PHP Error was encountered
Severity: Notice

Message: Undefined index: Id

Filename: controllers/Offer.php

Line Number: 16

I am just new in CI.
So please Help me.

User guide:
Quote:GET data is simply disallowed by CodeIgniter since the system utilizes URI segments rather than traditional URL query strings (unless you have the query string option enabled in your config file). The global GET array is unset by the Input class during system initialization.

The basics of using the GET global is to set the uri_protocol to PATH_INFO, PATH_INFO_ORG or REQUEST_URI.
If you want to enable query strings globally you set enable_query_string to true, or if you only want to use it for a few methods you add following as the first line of the method
$_GET = parse_str($_SERVER['QUERY_STRING']);

pistolPete your comment is not really helpful as as you see from my response it's very easy to circumvent the GET destruction of CI.

Well, kalpesh said he is new to CI.
That's why I thougt I'd show him how CI usually handles URL parameter.
It did not seem to be required to use GET variables, he only wanted to pass some parameters to his controller.

Theme © iAndrew 2016 - Forum software by © MyBB