Cheery:
<select name='s[s1]'>
<option value='1'>1</option>
</select>
<select name='s[s2]'>
<option value=''></option>
<option value='2'>2</option>
</select>
...
$sq = '';
$allowed_keys = array('s1', 's2');
foreach($_POST['s'] as $key => $value)
{
if (in_array($key, $allowed_keys))
$sql .= ' AND ' . $key . ' = "' . mysql_real_escape_string($value) . '"';
}
не проще что то такое сделать??
<select name='s[s1]'>
<option value='1'>1</option>
</select>
<select name='s[s2]'>
<option value=''></option>
<option value='2'>2</option>
</select>
...
$sq = '';
$allowed_keys = array('s1', 's2');
foreach($_POST['s'] as $key => $value)
{
if (in_array($key, $allowed_keys))
$sql .= ' AND ' . $key . ' = "' . mysql_real_escape_string($value) . '"';
}
не проще что то такое сделать??