I have 4 Select in HTML users
, industry
, lead_source
and country
. These selects have default value which is equal to select.
I want to make a query to select row from table leads where the only selected values.
This is the html code:
<select class="form-control" name="lead_source">
<option value="select">-SELECT-</option>
@foreach($leadssource as $leadsource)
<option value=""></option>
@endforeach
</select>
<select class="form-control" name="industry">
<option value="select">-SELECT-</option>
@foreach($industries as $industry)
<option value=""></option>
@endforeach
</select>
<select class="form-control" name="user">
<option value="select">-SELECT-</option>
@foreach($users as $user)
<option value=""></option>
@endforeach
</select>
<select class="form-control" name="country">
<option value="select">-SELECT-</option>
@foreach($countries as $country)
<option value=""></option>
@endforeach
</select>
I want to select only the values which is not equal to first option which is select.
I have tried:
To use if statements and check all the available possibilities but it is not good because if I added one more option then I have to add more bunch of if statements.
Here is a example of my first if statement if all options is selected:
if($leadSource != 'select' && $industry != 'select' && $user != 'select' && $country != 'select'){
$leads = Main::where('lead_source', '=', $leadSource)
-> where('industry', '=', $industry) -> where('country', '=', $country) -> where('user', '=', $user) -> paginate(50);
return view('filter.show') -> withLeads($leads);
}
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2eIyc2s
via IFTTT
Aucun commentaire:
Enregistrer un commentaire