Reputation: 1828
First off, I fully intend to AJAXify
my entire page, though I am first building each page as its own just for clarity's sake and to avoid some of the up front hassle involved in AJAX.
All was well until I received this error:
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: q
Filename: controllers/welcome.php
Line Number: 93
Here is my Welcome code:
function find($cliqid = '')
{
$search = $this->input->get($q);
$q = $search['q'];
if ($cliqid == '') { $cliq = "Find a new Cliq to Join!"; } else {
$cliq = $this->logic_m->get_cliq($cliqid);
}
$data['page'] = "Create a new cliq under the ".$cliq. " Cliq!";
//build components
$page['head'] = $this->load->view('template/components/head', $data, TRUE);
$page['header'] = $this->components_m->header($cliqid);
$page['cliqbar'] = $this->components_m->cliqbar($cliqid);
$page['content'] = $q;
$page['slideout'] = $this->components_m->slideout();
$this->load->view('template/template' ,$page);
}
and here is the URL thats opening the page /welcome/find/6/?q=234
$page['content']
is actually displaying variable $q
correctly, so I am not sure why its throwing out an error, or how to get rid of it.
Thank you!
Upvotes: 0
Views: 378
Reputation: 1338
It's an issue with this line:
$search = $this->input->get($q);
It should be:
$q = $this->input->get('q');
$q
isn't defined yet!
EDIT: You'll also want to take out the line below where $q is redefined.
Upvotes: 4