Welcome Guest, Not a member yet? Register   Sign In
ci search based on parameters user selects
#4

[eluser]JuanitoDelCielo[/eluser]
[quote author="techgnome" date="1285975109"]Make sure that on the search form the default unselected value is something that is testable (like 0, or -1, or blank)[/quote]

The $this->input->post() an get() functions return false if the value isn't set.

Code:
<select name="country">
    <option value="0">Select a Country...</option>
    <option value="1">UK</option>
</select>

<select name="city">
    <option value="0">Select a City...</option>
    <option value="1">London</option>
</select>

&lt;input name="data" value="value" &gt;

Code:
$country = $this->input->post('country');
$city = $this->input->post('city');
$data = $this->input->post('data');

if ( $country ) {

$this->db->where('country', $country);

}

if ( $city ) {

$this->db->where('city', $city);

}

if ( $data ) {

//...

}


Messages In This Thread
ci search based on parameters user selects - by El Forum - 10-01-2010, 12:02 PM
ci search based on parameters user selects - by El Forum - 10-01-2010, 12:14 PM
ci search based on parameters user selects - by El Forum - 10-01-2010, 12:18 PM
ci search based on parameters user selects - by El Forum - 10-01-2010, 01:05 PM
ci search based on parameters user selects - by El Forum - 10-01-2010, 01:09 PM
ci search based on parameters user selects - by El Forum - 10-01-2010, 03:03 PM



Theme © iAndrew 2016 - Forum software by © MyBB