Jump to content

List Query Help


spectsteve7

Recommended Posts

Hi everyone.

I'm not so good at PHP so please be kind. In short, I need to create a size selector using a menu dropdown that on submit sends you to a page that displays the results. I will need to have two different lists one for height and once for width. For example, I will be searching for sizes under 5" wide. Then searching for sizes 3" high. I've made menu list before from the database. My previous project once you pull down the menu list it automaticly got  the results. Any help on how to create this would be great, or if anyone could send me a tutorial that too would be good.

Thanks
Link to comment
Share on other sites

[code]
<?php
$sql1 = "SELECT * FROM `width` WHERE `width` < 5";
$res1 = mysql_query($sql1);
echo "<select name=width>";
while($row1 = mysql_fetch_assoc($res1)){
echo "<option value=$row1[width]>$row[width] inches</option>\n";
}
echo "</select>";
$sql2 = "SELECT * FROM `height` WHERE `height` < 3";
$res2 = mysql_query($sql2);
echo "<select name=height>";
while($row2 = mysql_fetch_assoc($res2)){
echo "<option value=$row[height]>$row[height] inches</option>\n";
}
echo "</select>";
?>
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.