CodeIgniter Forums
Multiple input fields search - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Multiple input fields search (/showthread.php?tid=59821)



Multiple input fields search - El Forum - 11-24-2013

[eluser]the_unforgiven[/eluser]
Hi all,

Help needed here:

I want to provide a form that has two input fields, date & time one field is called 'from' the other is called 'to' and also need to get the options from a dropdown menu that is pre-populated.

So if the user inputs a from and to date/time then selects a option from the dropdown I want it to search then database to match these and return the results, with pagination based on 15 results per page.

Code in my controller is here -> http://pastie.org/8505391

But it's not working and my form looks like this -> http://pastie.org/8505394

Really could do with some help on this please....


Multiple input fields search - El Forum - 11-25-2013

[eluser][email protected][/eluser]
Use following HTML code in view for "from" and "to" input fields :

Code:
<input type="text" class="form-control" name="from_field" id="from_field" class="form-control" placeholder="Date From" value="">

<input type="text" class="form-control" name="to_field" id="to_field" class="form-control" placeholder="Date To" value="">

And to access the post variables in controller :

Code:
$from = $this->input->post('from_field');
$to = $this->input->post('to_field');