How to shorten php code, in multiple combination of form result
<p>I have a php page that contains a form with 7 drop down boxes.
The problem is that the 0 to 6 boxes may be unselected.</p>

<p>It would be a lot of work to make a <code>switch</code> with a <code>case</code> for every combination.</p>

<p>What other method can i use?</p>

<p>thanks,
Sebastian</p>

<p><strong>EDIT</strong></p>

<p>For each combination i have to make different queries that contain only the selected items from the drop-boxes.</p>

<p>Ex. If the user selects 3 from the 7, the query has to pass 3 conditions.</p>

<p><strong>EDIT2</strong>
I don't know what the values of the drop-boxes are. Because they are built up using an mysql query in a <code>while</code> statement</p>

<p><strong>SOLUTION</strong></p>

<p>I've found a solution that should work. I haven't tested it yet.
First of all i want to check if what is selected in the drop-boxes.
`If($_POST[telefon]="empty"){$tel=""}</p>

<p>else{$tel="WHERE telefon =' "}`</p>

<p>after this i can concatenate the <code>$tel</code> string with the <code>$_POST['telefon']</code> string.
<code>$query_tel=$tel.$_POST['telefon']." ' ";</code></p>

<p>Final query string would look like this <code>$query="SELECT * table ".$query_telefon." ,".$query_ziua....(and so on)</code></p>

<p>Of course i have to be very careful with the query that will result, for missing commas, apostrophes and so on. But i guess it's the simplest way.</p>
