too long

Tying myself in knots a little bit with cURL. Using codeigniter for my framework and downloaded the CURL lib from getsparks.org/packages/curl . I have this URL http://localhost:8984/rest?run=loc.xq&$a=York so this is a Rest for BaseX that I pass in a city (like York) and it shows me a carpark, This works in my browser. So what i wanted to do is have a user type the name into a form and pass that to basex and display the results. I have me view, controller set up, and this is currently the code I have in the controller

 $this->load->library('curl');
 $url = "http://localhost:8984/rest?run=loc.xq&$a=";
 $datai = array($this->input->POST('carpark_location'));
 $results = $this->curl->simple_get($url,$datai);

so this to me looks right, but its not, comes back with an error,

Message: Undefined variable: a

which I am guessing its picking $a out of the text as a variable, how would I make it ignore that? not sure if just that will solve my issue but printing out the $url and $datai looks like below?

 http://localhost:8984/rest?run=loc.xq&=Array ( [0] => York ) 

what am I missing?

Try this instead:

$url = 'http://localhost:8984/rest?run=loc.xq&$a='

Because it is inside single quotes instead of double quotes, PHP should treat $a as if it is part of the string instead of as a variable.