473,473 Members | 2,031 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

drop down box problem

15 New Member
Hi,
In my php page i have combo box which has problem numbers.

Eg:
Select the Problem ID to view the Problems :
Expand|Select|Wrap|Line Numbers
  1. <select name="proid" onChange="dispValues()">
  2. <option value="">Please Select</option>
  3. <option value="PROB001">PROB001</option>
  4. <option value="PROB002">PROB002</option>
  5. <option value="PROB003">PROB003</option>
  6. <option value="PROB004">PROB004</option>
  7. <option value="PROB005">PROB005</option>
  8. </select>
  9.  
when i select the problem number in combo box, it should display customername,city,email,problem details from the db in html table format.
how do i retrieve combo box value i.e problem numbers in php scripts. i.e how to retrieve the combo box value in sql query. u pls help me.Thats y i put ? mark there.what is the query to retrieve te values from the db when i click the combo box
[php]
<?php
$sql="select * from customer where probid="?"
$result=mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['custname'] ."</td>";
echo "<td>" . $row['city'] . "</td>";
echo "<td>" . $row['phno']. "</td>";
echo "<td>" . $row['email']. "</td>";
echo "<td>" . $row['problem']. "</td>";
echo "<td>" . $row['probid']. "</td>";
echo "</tr>";
}
?>[/php]

Please read the Posting Guidelines before you post in this forum!
Especially the part about enclosing shown code within code or php tags!!!

moderator
Mar 5 '07 #1
2 1345
ak1dnar
1,584 Recognized Expert Top Contributor
Try This coding.I dont know what you have done in dispValues() function.
Make sure to POST the Form using this function.
Thats what i am putting this action="" blank.
since you are not using a Button, using JavaScript you have to Submit the form.
:)

[HTML]<form name="myform" action="" method="POST">
<select name="proid" onChange="dispValues()">
<option value="">Please Select</option>
<option value="PROB001">PROB001</option>
<option value="PROB002">PROB002</option>
<option value="PROB003">PROB003</option>
<option value="PROB004">PROB004</option>
<option value="PROB005">PROB005</option>
</select>
</form>[/HTML]

your_php_file.php

[PHP]<?php
$probid = $_POST['proid'];

$sql="select * from customer where probid='$probid'"
$result=mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['custname'] ."</td>";
echo "<td>" . $row['city'] . "</td>";
echo "<td>" . $row['phno']. "</td>";
echo "<td>" . $row['email']. "</td>";
echo "<td>" . $row['problem']. "</td>";
echo "<td>" . $row['probid']. "</td>";
echo "</tr>";
}
?>[/PHP]
Mar 5 '07 #2
ronverdonk
4,258 Recognized Expert Specialist
How could we help without all the code available? So, show the DispValues() function code.

And enclose it within code tags!

Ronald :cool:
Mar 5 '07 #3

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

Similar topics

46
by: Kingdom | last post by:
In my data base I have a list of componet types e.g. type A - I have 8 off - type B I have 12 off etc. I'm using Set objRS = objDC.Execute("Select DISTINCT Component_Type FROM Parts_Table") ...
6
by: PT | last post by:
I got a form with many text boxes, checkboxes and 3 drop downs. From that 3, 2 are dependant. I can choose one drop down, and the next drop down should display the dependant values of the first...
2
by: ehm | last post by:
I am working on creating an editable grid (for use in adding, deleting, and editing rows back to an Oracle database). I have a JSP that posts back to a servlet, which in turns posts to a WebLogic...
3
by: KK | last post by:
Drop-down menus are the hottest thing since Wonder Bread but . . . 1. Alot of people put them in the they-look-nice-but-you-cant-code-them-right-so-they-always-look-messed-up category (a la...
4
by: Terren | last post by:
I need to be able to edit a drop down box is asp. On my web app I populate a drop down box from a databse. The user can then select an option that will then be saved to a Database for example Mr...
4
by: simon.cigoj | last post by:
I have an javascript made menu and some forms with the dropdown element. When the menu opens and scrolls down the drop down is displeyed over the menu and obscures the menu choices. I have this...
13
by: Leszek Taratuta | last post by:
Hello, I have several drop-down lists on my ASP.NET page. I need to keep data sources of these lists in Session State. What would be the most effective method to serialize this kind of data...
5
by: Vigneshwar Pilli via DotNetMonster.com | last post by:
string connectionString1 = "server=(local); user=sa;password=sa; database=sonic"; System.Data.SqlClient.SqlConnection dbConnection1 = new System.Data.SqlClient.SqlConnection(connectionString1);...
1
by: Capitan Catarro | last post by:
Hi everybody, I have a little problem with drop down menus. I have a PHP page in which I extract some categories (from a database). I put those categories in a drop down menu without problems. I...
3
by: jcassan | last post by:
Hello folks. I am new to these forums and have something, which has been stumping me for little while. I am using pspell to spellcheck a scrolling textbox (textarea) containing user input. I...
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
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
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
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...
1
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...
0
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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
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.