Current location: Hot Scripts Forums » Programming Languages » PHP » combo box


combo box

Reply
  #1 (permalink)  
Old 10-09-06, 12:25 AM
maxat maxat is offline
Newbie Coder
 
Join Date: Jul 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Question combo box

Hi!
I need help in my project. I have database named "product", fields are pd_id, pd_name and price. I need to retrieve product name into combo box and based on selection display price at the same time when user selects the product. Now i can retrive data, but don't know how to display the price of selected product. Any help will be highly appreciated.
Reply With Quote
  #2 (permalink)  
Old 10-09-06, 01:02 AM
maxat maxat is offline
Newbie Coder
 
Join Date: Jul 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
I dont know to make it work with java script if you have an example could you post it?
there is my current code
PHP Code:

<?php

$sql 
"SELECT pd_id, pd_name, price, p.cat_id , c.cat_id, c.name
FROM product p, category c where p.cat_id = c.cat_id and c.name = 'mainboard'
ORDER BY pd_id"
;
$result dbQuery($sql) or die('Can not get product list.' mysql_error());

$options="";

while (
$row=mysql_fetch_array($result)) {

$id=$row["pd_id"];
$name=$row["pd_name"];
$price=$row["price"];
$options.="<OPTION VALUE=\"$id\">".$name.'</option>';


}
?>
Code:
<table>
<tr>
<td>Motherboard</td>
<td><SELECT class="box" NAME="motherboard"><OPTION><?=$options?></OPTION></SELECT></td>
<td> $price </td>
</tr>
</table>

Last edited by Christian; 10-09-06 at 02:26 AM.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Combo box image change with names from database Frogger ASP 4 07-09-06 04:54 AM
Combo Box Question iamtat Visual Basic 3 10-18-05 01:49 PM
Combo Box Search creepycridler PHP 1 09-14-05 08:55 AM
dynamic combo box jaishalg PHP 1 02-18-05 09:37 AM
help in combo box mathfxr ASP 0 12-28-04 10:05 PM


All times are GMT -5. The time now is 05:43 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.