Here is my output of print_r($_POST)
array([id] => '123', [name] => '', [place] => '', [color] => '')
Where name , place and color are optional fields submitted by user..... user may select only name, place or color, name + color, color + place, or all three name + color + place.
How can I put where condition for these options chosen by user? Let's say for example, In Laravel we select DB table using the following statement...
$Select_db = Db::table('mytable')
->where('name', Input::get('name'))
->where('place', Input::get('place'))
->where('color', Input::get('color'))
->select()
->get();
As you can see above condition works only if there is an input for all fields from user, based on user input I want add where condition, how do we fix this???
Note: In this particular scenario, I am aware I could use isset() for each condition. However, what if there are many optional inputs?
multiple where conditionsfor the known input....but in my case its unknown input seems to be different from my question...