display data based on dropdown selected

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pradeepcarya
Forum Newbie
Posts: 5
Joined: Tue Nov 08, 2011 4:36 am

display data based on dropdown selected

Post by pradeepcarya »

hi...i need that based on drop down value of "vendor" and "route",remaining value for "route number" and "route name" should come automatically from database table for a particular vendor and route selected in dropdown.

kindly tell me how to do it.


below is my htmlcode.

Code: Select all

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>CTT- Route Details</title>

<script language="javascript" src="Code/calendar/cal2.js"></script>
<script language="javascript" src="Code/calendar/cal_conf2.js"></script>
</head>


<body style="font-family: Arial" background="Images/public-transportation.jpg" >


<form name="form_route" action="php_qry/qry_form_route.php" method="post">
<table align="center" bgcolor="#666666" bordercolor="#000066" bordercolordark="#000066" width="1000px"> 
<tr > 
<td bgcolor="#0000CC" colspan="2"><font color="#FFFFFF"><strong>Route Details Form</strong></em></font></td>
<td bgcolor="#0000CC" colspan="2" align="right"> <font color="#FFFFFF"><em><strong>Capgemini - Gurgaon Centre</strong></em></font></td>
</tr>

<tr > 
<td><font color="red"><strong><font size="+2">*</strong></font></font>Vendor <strong>:</strong> </td>
<td>
<select name = "vendor" >
<option value ="Vendor_1">Vendor 1</option>
<option value ="Vendor_2">Vendor 2</option>
<option value ="Vendor_3">Vendor 3</option>
<option value ="Vendor_4">Vendor 4</option>
<option value ="Vendor_5">Vendor 5</option> 
<option value ="Vendor_6">Vendor 6</option>
<option value ="Vendor_7">Vendor 7</option>
<option value ="Vendor_8">Vendor 8</option>
<option value ="Vendor_9">Vendor 9</option>
<option value ="Vendor_10">Vendor 10</option>
</select> 
</td> 
</tr>

<tr>
<td><font color="red"><strong><font size="+2">*</strong></font></font>Route <strong>:</strong> </td>
<td>
<select >
<option value ="Route_1">Route 1</option>
<option value ="Route_2">Route 2</option>
<option value ="Route_3">Route 3</option>
<option value ="Route_4">Route 4</option>
<option value ="Route_5">Route 5</option>
<option value ="Route_6">Route 6</option>
<option value ="Route_7">Route 7</option>
<option value ="Route_8">Route 8</option>
<option value ="Route_9">Route 9</option>
<option value ="Route_10">Route 10</option>
<option value ="Route_11">Route 11</option>
<option value ="Route_12">Route 12</option>
<option value ="Route_13">Route 13</option>
<option value ="Route_14">Route 14</option>
<option value ="Route_15">Route 15</option>
<option value ="Route_16">Route 16</option>
<option value ="Route_17">Route 17</option>
<option value ="Route_18">Route 18</option>
<option value ="Route_19">Route 19</option>
<option value ="Route_20">Route 20</option>
</select> 
</td> 
</tr> 

<tr>
<td><br><font color="red"><strong><font size="+2">*</strong></font></font>Route Number </td>
<td><br><input type="text" name="Route_Number" value="" maxlength="20" size="30"> </td>
</tr> 

<tr>
<td><font color="red"><strong><font size="+2">*</strong></font></font>Route Name </td> 
<td><input type="text" name="Route_Name" value="" maxlength="20"size="30"/> </td>
</tr> 


</table>

</td>
</tr>
</table>

</form>
</body>
Last edited by Benjamin on Tue Nov 08, 2011 12:45 pm, edited 1 time in total.
Reason: Added [syntax=php|sql|css|javascript] and/or [text] tags.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: display data based on dropdown selected

Post by social_experiment »

pradeepcarya wrote:kindly tell me how to do it.
Have you created any php code that you can paste?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: display data based on dropdown selected

Post by Benjamin »

:arrow: Moved to PHP - Code
JimJiang
Forum Newbie
Posts: 5
Joined: Wed Nov 09, 2011 7:32 am

Re: display data based on dropdown selected

Post by JimJiang »

What do you want? Is that?

Code: Select all

<select name = "vendor" >
<option value ="Vendor_1">Vendor 1</option>
<option value ="Vendor_2" selected="selected">Vendor 2</option>
<option value ="Vendor_3">Vendor 3</option>
<option value ="Vendor_4">Vendor 4</option>
<option value ="Vendor_5">Vendor 5</option> 
<option value ="Vendor_6">Vendor 6</option>
<option value ="Vendor_7">Vendor 7</option>
<option value ="Vendor_8">Vendor 8</option>
<option value ="Vendor_9">Vendor 9</option>
<option value ="Vendor_10">Vendor 10</option>
</select>
"Vendor 2" is selected
Post Reply