473,508 Members | 2,370 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how can i show specific data based on currently selected option in a dropdown list?

21 New Member
little background: currently putting together a website that is selling products, many of which come in various sizes, with respectively different prices. I have the database set up to handle all of this.

However, my issue is thus - how can I go about dynamically changing the product type from dropdown on the product's page, based on the user selecting, display related product from this category on the webpage.

My current code:
Expand|Select|Wrap|Line Numbers
  1. <?php 
  2. include('connect-db.php');
  3. ?>
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6. <head>
  7. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  8. <title>Untitled Document</title>
  9. </head>
  10.  
  11. <body>
  12. <form name="product" method="post" action="">
  13. <table align="center" width="10%" border="0" cellspacing="0" cellpadding="0">
  14. <tr>
  15. <td>Shoplist</td>
  16. <td>
  17. <select name="shoplist">
  18. <?php 
  19.  
  20. $sql = mysql_query("SELECT art_name FROM category");
  21.  
  22. while ($row = mysql_fetch_array($sql)){
  23.  
  24. ?>
  25. <option value="shoplist1"><?php echo $row['art_name']; ?></option>
  26.  
  27. <?php
  28. // close while loop 
  29. }
  30. ?>
  31. </select>
  32. </td>
  33. <td><input name="go" type="button" value="Go" /></td>
  34. </tr>
  35. </table>
  36. </form>
  37. </body>
  38. </html>
  39.  
Mar 19 '13 #1
5 2785
acoder
16,027 Recognized Expert Moderator MVP
You have a number of options, e.g.
1. use a submit button which will submit the form and display the results based on the category selected.
2. use Ajax to get the results without reloading the page
3. use an iframe

I'd suggest number 2 and allow for number 1 where JavaScript is not enabled.
Mar 19 '13 #2
Monomita Har
21 New Member
dear acoder,

Please help me regarding this issue.I have one dropdown list with one button.When user select one among them the web page will show the image from mysql database.

Can you please show me one example if I add one "GO" button and use iframe to show the result on that page? I am very new in this.Thanx in advance!
Mar 20 '13 #3
r035198x
13,262 MVP
He said to use AJAX. Did you read about it to find out how to use it?
Mar 20 '13 #4
Monomita Har
21 New Member
Yeah I read it and also tried to find out the problem but cant be able.That's why I request you to explain a little bit.Thanks for any help.
Mar 20 '13 #5
acoder
16,027 Recognized Expert Moderator MVP
What did you try? Please post your attempt.
Mar 20 '13 #6

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

Similar topics

3
10174
by: veganeater | last post by:
Hi, I'm wondering if there's a way that I can select which <div> to show based on the user's selection from a dropdown/listbox form. <form name="form1" method="post" action=""> <select...
5
3337
by: david | last post by:
I have a question in the following. Any one could give me a help? Thanks David The dataset is declared and created at Class level. My source code is here: Private Sub...
3
12102
by: Xerxes | last post by:
Hi, I have 3 images of the same product in 3 different colors. I want to display the correct color product based on what color is selected using a dropdown. Can you please tell me how I can do...
5
3136
by: SA SA | last post by:
Is this possible? I have three items in drop down "Select Payment Type", "Credit Card" and "Check". if user select Credit card then i need to post the form variables to different URL than check...
7
1707
by: arti | last post by:
In ASP.Net, I have a Dropdown List bound to a City Table with City Id as Value & City names as Data Text field. I want to Show a few Favourite Cities on top as well as in their correct place in the...
1
1330
by: shiva srivastava | last post by:
can i select more than one option in DropDownList? if yes then what is the code for this in vb.net? plz reply.
5
5237
parshupooja
by: parshupooja | last post by:
Hello, I am using asp.net C# I have a form which has various controls such as Dropdownlist, textboxes. If user select value"10" or "13' from drop down than textbox field should become mandatory,...
1
2139
by: printline | last post by:
Hello all Hopefully someone can help me with this issue. I have some information from a database which i show in a table. In this table i have various columns that are filled out with some of...
0
1119
by: =?Utf-8?B?TWlrZSBNaWxpYW4=?= | last post by:
I have a dropdownlist control in a formview and I am trying to enable 2 way databinding. Only, the option is not available. I look at the "Edit Databinding" option of another DDL control in the...
3
1465
by: NDayave | last post by:
How do, I have a form with a number of textboxes that hide and unhide depending on a number or Laps of a Race. Currently I have this code to make them hide and unhide: Dim LapBox as String ...
0
7224
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
7118
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
7379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7038
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
7493
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1550
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.