By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,162 Members | 1,038 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,162 IT Pros & Developers. It's quick & easy.

display data from data base when onchange in drow down

P: 1
i have html page and two drop down when i change value in service drop down the value changed in anothed drop down

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML>
  2.  
  3. <html>
  4. <head>
  5.  
  6.     <title>Gestion Des Non-Conformité</title>
  7.     <link rel="stylesheet" href="css/style.css"/>
  8.    <!-- <script type="text/javascript" src="chemindiv.js">
  9. </script>-->
  10.      <script type="text/javascript" src="JScript_1.11.js"></script>    
  11.      <script type="text/javascript" src="Copie (2) de jvc.js"></script>
  12.  
  13. <style type="text/css">
  14.    h3{font-family: Calibri; font-size: 22pt; font-style: normal; font-weight: bold; color:SlateBlue;
  15. text-align: center; text-decoration: underline }
  16.  
  17. table{font-family: Calibri; color:white; font-size: 11pt; font-style: normal;
  18.  background-color: #4c8f97; border: 5px solid #1c2137}
  19.  
  20. table.inner{border: 0px}
  21. </style>
  22.  
  23.  
  24.  
  25. <script type="text/javascript" src="jquery-1.7.2.min.js"></script>
  26.  
  27. <script>
  28.     function Submitt(){
  29.         document.getElementById("allserivce").submit();
  30.     }
  31. </script>
  32.  
  33.  
  34. <!-- <script type="text/javascript">
  35.  
  36.      $.get('Copie de selectemployee_par_service.asp', function (data) {
  37.          $('#allserivce').html(data);
  38.      });
  39.  
  40. </script>-->
  41.  
  42. </head>
  43.  
  44.  
  45.  
  46. <body >
  47.     <div id="body">
  48.  
  49.  
  50.                  <h3>identification de non-conformite</h3>
  51.  
  52. <form action="Employee.asp" method="POST">
  53.  
  54. <table align="center" cellpadding = "10" >
  55.  
  56. <!----- N dossie ---------------------------------------------------------->
  57. <tr>
  58. <td>N Dossier</td>
  59. <td><input type="text" name="First_Name" maxlength="30" id="autree" onclick="check();" />
  60. </td>
  61. </tr>
  62.  
  63.  <!----- test ---------------------------------------------------------->
  64.  <tr>
  65.  
  66. <td>Service </td>
  67. <td><select  onchange="this.form.submit();Loaddd('Employee.asp','nservicee');" name="comboser" id="allserivce">
  68.  
  69. </select></td>
  70. </tr>
  71.  
  72. <!----- choix service ---------------------------------------------------------->
  73.  
  74. <tr>
  75.   <td>Choix</td> 
  76.   <td><select id="nservicee">
  77.  
  78.   </select></td>   
  79. </tr>
  80.  
  81. <!----- nature ---------------------------------------------------------->
  82. <tr>
  83. <td>Nature</td>
  84. <td><input type="text" name="Last_Name" maxlength="30"/>
  85. </td>
  86. </tr>
  87.  <!-----delai---------------------------------------------------------->
  88. <tr>
  89. <td>Delai</td>
  90. <td><input type="text" name="Email_Id" maxlength="100" /></td>
  91. </tr>
  92. <!----- Processus-------------------------------------------------------->
  93. <tr>
  94. <td>Processus</td>
  95. <td>
  96. <select name="Birthday_day" id="Birthday_Day">
  97. <option value="1">Processus 1</option>
  98. <option value="2">Processus 2</option>
  99. <option value="3">Processus 3</option>
  100. <option value="4">Processus 4</option>
  101. </select>
  102.  </td>
  103.  </tr>
  104.  <!----- Activite-------------------------------------------------------->
  105.  <tr>
  106.  <td>Activite</td>
  107.  
  108.  <td>
  109. <select id="Birthday_Month" name="Birthday_Month">
  110. <option value="October">Activite 1</option>
  111. <option value="November">Activite 2</option>
  112. <option value="December">Activite 3</option>
  113. </select>
  114.  </td>
  115.  </tr>
  116.  <!----- AC et AP-------------------------------------------------------->
  117.  <tr>
  118.  <td>AC et AP</td>
  119.  
  120.  <td>
  121. <select name="Birthday_Year" id="Birthday_Year">
  122. <option value="oui">Oui</option>
  123. <option value="non">non</option>
  124. </select>
  125. </td>
  126. </tr>
  127.  
  128.  <tr>
  129. <td colspan="2" align="center">
  130. <input type="button" value="Submit"/>
  131. <input type="reset" value="Reset"/>
  132. </td>
  133. </tr>
  134.  
  135. </table>
  136.  
  137. </form>
  138.     </div>
  139.  
  140.  
  141. </body>
  142. </html>
  143.  
  144.  
  145.  
  146. asp page 
  147.  
  148.  <%@ LANGUAGE="VBSCRIPT" %>
  149. <!-- #include file="Connect.inc" -->
  150.  
  151.  <%
  152.  
  153.                 strconnexion = connectionstr
  154.                 Dim Connection
  155.                 Dim Recordse
  156.                 Dim Recordse1
  157.                 Dim Recordse2
  158.                 Dim sql
  159.                 Dim sql1
  160.                 Dim sql2
  161.                 Dim serrr
  162.                 serrr="CT"
  163.  
  164.  
  165.  
  166.  
  167.                 sql1= "SELECT * FROM Servicee where Libelle_service='"& Request.Form("comboser") &"'"
  168.                 Set Connection = Server.CreateObject("ADODB.Connection")
  169.                 Set Recordse1 = Server.CreateObject("ADODB.Recordset")
  170.  
  171.                 Connection.Open strconnexion
  172.                 Recordse1.Open sql1,Connection
  173.  
  174.                 if Recordse1("ID_service") = 2 then 
  175.  
  176.  
  177.                        sql="select * from Employee where Employee.ID_service="& Recordse1("ID_service") &" and ID_profile=2 "               
  178.                        Set Recordse = Server.CreateObject("ADODB.Recordset")
  179.                        Recordse.Open sql,Connection
  180.                        Response.Write("<select>")
  181.                            If Recordse1.EOF Then
  182.                                 Response.Write("<option>Aucune Employee</option>")
  183.                           else
  184.                                   Do While NOT Recordse.Eof 
  185.                                   Response.Write("<option>"& Recordse("Nom_emp")+" "+ Recordse("Prenom_emp") &"</option>")
  186.                                   Recordse.MoveNext
  187.                                   loop
  188.                          end If
  189.                          Response.Write("</select>")
  190.              '   else
  191.  
  192.               '      sql2 = "select * from Employee where ID_service ="& Recordse1("ID_service") &""
  193.                '     Recordse2.Open sql2,Connection
  194.                 '         If Recordse2.EOF Then
  195.                  '              Response.Write("<option>Aucune Employee</option>")
  196.                   '       else
  197.                    '            Do While NOT Recordse2.Eof 
  198.  
  199.                     '           Response.Write("<option>"& Recordse2("Nom_emp")& "</option>")
  200.  
  201.  
  202.                      '          Recordse2.MoveNext
  203.                       '         loop
  204.                        ' end If
  205.                  end If
  206.  
  207.  
  208.  
  209.                 Recordse.Close
  210.                 Set Recordse=nothing
  211.                 Recordse1.Close
  212.                 Set Recordse1=nothing
  213.                 Connection.Close
  214.                 Set Connection=nothing
  215.  
  216.               %>
Apr 22 '14 #1
Share this question for a faster answer!
Share on Google+

Post your reply

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