473,406 Members | 2,220 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Create dropdown menu retrieves all items in a database

Expand|Select|Wrap|Line Numbers
  1. $query_Test = "SELECT * FROM Products WHERE Product_Type='$Product_Type' ORDER BY Product_Title ASC";
  2. $query_limit_Test = sprintf("%s LIMIT %d, %d", $query_Test, $startRow_Test, $maxRows_Test);
  3. $Test = mysql_query($query_limit_Test, $WPhoto) or die(mysql_error());
  4. $row_Test = mysql_fetch_assoc($Test);
  5.  
  6.  
  7.             <form id="form1" name="form1" method="get" action="products.php">
  8.   <p>
  9.     <label>Narrow Your Search:
  10.       <select name="Product_Type" method="post">
  11.       <option value="Product_Type" selected="selected">All</option>
  12.         <option value="Chips">Chips</option>
  13.         <option value="Dips, Marinades">Dips, Marinades</option>
  14.         <option value="Rubs">Rubs</option>
  15.       </select>
  16.     </label>
  17.     <label>
  18.       <input type="submit" name="button" id="button" value="Submit" />
  19.     </label>
  20.   </p>
  21. </form>
  22.  
Dec 3 '12 #1
4 2227
And then I have....

Expand|Select|Wrap|Line Numbers
  1.             <?php do { ?>
  2.             <p><img src = "images/<?php echo $row_Test['Product_Image_Small']; ?>" align="left"/><br />
  3.                <a href="productdetails.php?recordID=<?php echo $row_Test['Product_ID']; ?>" >
  4.                <?php echo $row_Test['Product_Title']; ?></a><br />
  5.                <?php echo $row_Test['Product_Type']; ?><br />
  6.                <?php echo $row_Test['Product_Description']; ?><br />
  7.                <?php } while ($row_Test = mysql_fetch_assoc($Test)); ?>
  8.             </p>
  9.          </div>
  10.  
Dec 3 '12 #2
Rabbit
12,516 Expert Mod 8TB
I don't understand what your question is. Just loop through your result set and write out the options to the document.
Dec 3 '12 #3
Hi Rabbit,
Please forgive my ignorance, but how do I go about doing that?
Dec 3 '12 #4
Rabbit
12,516 Expert Mod 8TB
The same way you do it in post #2. Except instead of putting it between a p element, put it between an option element.
Dec 3 '12 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Tim | last post by:
Hi, I've been searching the web for hours now and found lots and lots of javascript files with which you can create dropdown menu's, but with all of them you have to specify the width of the...
2
by: Calvin KD | last post by:
Hi everyone, Can someone show me or point me in the right direction as how to create a "dropdown menu" which displays the menu items as a separete layer over the top of the contents of the page...
6
by: Sandy | last post by:
Hello - I have a book that illustrates pulling menu items from a Sql Server table into an ascx via a stored procedure. Is this something that is done in the real world? I do like the effect...
2
by: Ian Davies | last post by:
Hello Ive been informed that I need to do the following in javascript. I have two drop down menus in my php script. The items displayed in the second is dependent on which item is choosen from the...
1
by: pawarsac | last post by:
Hello I am new to PHP. I want to create DropDown menu. When user hovers mouse over the text in menu, subcategory should be dropped down. How to create such PHP page and javascript for this ? ...
4
torquehero
by: torquehero | last post by:
Hi all :) I have created a horizontal navbar using Xara Menumaker. The Menu items have several dropdown menus. Its a javascript. When the mouse cursor is moved over any menu item, a dropdown...
1
akhan
by: akhan | last post by:
i used the following code to enter data in dropdown menu : <? $con=mysql_connect("","",""); mysql_select_db('investment',$con); $query="select *from personal_info"; $res =...
19
by: Jim | last post by:
Hi, I have two questions/problems pertaining to CSS horizontal dropdown menus and am hoping that someone here can help me out. (1) I'm having a problem centering the menu. I picked up the...
3
by: raaja | last post by:
How to create Horizontal dropdown menu, tat menu items coming from database.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.