Top of the Mornin' to ya'll!
okay, here's the situation I am currently facing:
I have 6 checkboxes:
red, blue, brown, black, white, and green.
Based on which one the user "checks", the results would be displayed from the db.
So if user checks red, blue, and brown boxes, the result page should display those three colored shirts and NOT DISPLAY black, white and green colored shirts.
Here's the problem:
How to query this? I mean, if I do IF statements, it would be too many, long/tedious, and error prone!
Any simpler way to approach/tackle this?
Here's my html/php code so far:
index.php
Code: Select all
echo "<form name='mod_color' method='post' action='index.php' enctype='multipart/form-data'>";
echo "<input type='checkbox' name='red' $redcheck onclick=\"reload()\";> <img src='images/options/red.png' alt='red'> Red";
echo "<input type='checkbox' name='blue' $bluecheck onclick=\"reload()\";> <img src='images/options/blue.png' alt='blue'> Blue";
echo "<input type='checkbox' name='brown' $browncheck onclick=\"reload()\";> <img src='images/options/brown.png' alt='brown'> Brown";
echo "<input type='checkbox' name='black' $blackcheck onclick=\"reload()\";> <img src='images/options/black.png' alt='black'> Black";
echo "<input type='checkbox' name='white' $whitecheck onclick=\"reload()\";> <img src='images/options/white.png' alt='white'> White";
echo "<input type='checkbox' name='green' $greencheck onclick=\"reload()\";> <img src='images/options/green.png' alt='green'> Green";
echo "</form>";Code: Select all
echo "<script type=\"text/javascript\">
function reload(){
document.mod_color.submit();
}
</script>";here's how I do that:
Code: Select all
$red = (isset($_POST['red']) ? 1 : 0);
if ($red == '1'){
$redcheck = "checked";
}else{
$redcheck = "";
}
...-Matt