php - How can I make a select statement appear when another select statement is selected -


so "type1" select statement select issue category, , based on issue want dropdown of employees deal issue in drop down. how make hidden select statements occupy same space?

here code:

<!doctype html> <html>     <head>         <title>issuereport</title>         <script src = "../../jquery.js"></script>         <style>             body{                 padding:0;                 margin:0;             }             #box {                 padding: 5px;                 color:black;                 margin: 0 auto;                 border-style: solid;                 border-color: #0000e6;                 border-width: 2px;                 background-color: #58c6eb;                 width: 162px;                 height: 687px;                 float: left;                 border-radius: 10px;             }             .word{                 color: #0000e6;             }             .buttons{                 background-color: #ccffff;                 border-radius: 5px;             }         </style>         <script>             function showform(){                     var issue = document.getelementbyid("type1").value;                     if(issue == 'program glitch'){                         document.getelementbyid("it1").style.display = "block";                     }                     $("#type1").onchange(function{                     });                 }             $(document).ready(function(){                 $("#sub").click(function(){                     var user_issue = $("#issue").val();                     var user_priority = $("#priority").val();                     var user_type = $("#type1").val();                     var user_author = $("#author").val();                     $.post("bugreport.php",{issue:user_issue,priority:user_priority,type1:user_type,author:user_author},function(data){                         $("#result").html(data);                     });                 });                 $("#sub").click(function(){                     document.getelementbyid('issue').value='';                     $('#type1').prop('selectedindex', 0);                     $('#priority').prop('selectedindex', 1);                 });             });         </script>     </head>     <body>         <div id="box">         <h3 class = "word" style = "margin:10px 30px 30px 30px;">issue report</h3>         <div class = "word" style = "width: 100px; margin-left: auto; margin-right: auto">type of issue:</div>             <div style = " max-width: 150px; margin-left: auto; margin-right: auto; padding: 2px">             <form action="bugreport.html" method="post">             <select onchange = "showform()" class = "buttons" name = "type1" id = "type1" style = 'max-width: 150px;'>             <?php                     $servername = "localhost";                     $username = "user";                     $password = "pass";                     $database = "database";                      $con = mysqli_connect($servername,$username,$password,$database);                         if($con->connect_error){                         die("connection failed " . $con->connect_error);                     }                 $sql1 = "select issue_name, issue_description issue";                 $result = mysqli_query($con,$sql1);                 while ($row = mysqli_fetch_array($result)) {                     $issue = $row['issue_name'];                     $des = $row['issue_description'];                     echo "<option value = '$issue' title = '$des'>$issue</option>";                     }             ?>             </select>             </form></div>         <form action="bugreport.html" method="post">         <div id = "buyers1" style = "visibility:hidden;"><select class = "buttons" name = "author" id = "buyers" style = "margin: 0px 30px 0px 30px;">                 <?php                      $sql = "select first, last employee department_id = '1'";                     $result = mysqli_query($con,$sql);                     while ($row = mysqli_fetch_array($result)) {                         $name = $row['first'] . ' ' . $row['last'];                         echo "<option value = '$name'>$name</option>";                      }                 ?>             </select></div></form>             <div id = "operations1" style = "visibility:hidden;"><form action="bugreport.html" method="post">         <select class = "buttons" name = "author" id = "operations" style = "margin: 0px 30px 0px 30px;">                 <?php                      $sql = "select first, last employee department_id = 2";                     $result = mysqli_query($con,$sql);                     while ($row = mysqli_fetch_array($result)) {                         $name = $row['first'] . ' ' . $row['last'];                         echo "<option value = '$name'>$name</option>";                      }                 ?>             </select></form></div>             <div id = "it1" style = "display:none;"><form action="bugreport.html" method="post">         <select onchange = "showform()" class = "buttons" name = "author" id = "it" style = "margin: 0px 30px 0px 30px;">                 <?php                      $sql = "select first, last employee department_id = 3";                     $result = mysqli_query($con,$sql);                     while ($row = mysqli_fetch_array($result)) {                         $name = $row['first'] . ' ' . $row['last'];                         echo "<option value = '$name'>$name</option>";                      }                 ?>             </select></form></div>             <div id = "customerservice1" style = "visibility:hidden;"><form action="bugreport.html" method="post">         <select class = "buttons" name = "author" id = "customerservice" style = "margin: 0px 30px 0px 30px;">                 <?php                      $sql = "select first, last employee department_id = 4";                     $result = mysqli_query($con,$sql);                     while ($row = mysqli_fetch_array($result)) {                         $name = $row['first'] . ' ' . $row['last'];                         echo "<option value = '$name'>$name</option>";                      }                 ?>             </select></form></div>             <div id = "hr1" style = "visibility:hidden;"><form action="bugreport.html" method="post">         <select class = "buttons" name = "author" id = "hr" style = "margin: 0px 30px 0px 30px;">                 <?php                      $sql = "select first, last employee department_id = 5";                     $result = mysqli_query($con,$sql);                     while ($row = mysqli_fetch_array($result)) {                         $name = $row['first'] . ' ' . $row['last'];                         echo "<option value = '$name'>$name</option>";                      }                 ?>             </select></form></div>             <div id = "logistics1" style = "visibility:hidden;"><form action="bugreport.html" method="post">         <select class = "buttons" name = "author" id = "logistics" style = "margin: 0px 30px 0px 30px;">                 <?php                      $sql = "select first, last employee department_id = 6";                     $result = mysqli_query($con,$sql);                     while ($row = mysqli_fetch_array($result)) {                         $name = $row['first'] . ' ' . $row['last'];                         echo "<option value = '$name'>$name</option>";                      }                 ?>             </select></form></div>         <form action="bugdisplayandreply.html" method="post">         <label></label><br>         <textarea style = "max-width: 156px; background-color: #f3f9ff; border-color: #0000e6;" cols="20" rows="34" name="issue" id = "issue" placeholder = "enter issue here" "></textarea></form><br>             <div class = "word" style = "width: 50px; margin-left: auto; margin-right: auto">priority:</div>             <div style = "width: 70px; margin-left: auto; margin-right: auto; padding: 2px">             <form action="bugreport.html" method="post">             <select class = "buttons" name = "priority" id = "priority">                 <option value = "low">low</option>                 <option value = "regular" selected>regular</option>                 <option value = "high">high</option>                 <option value = "urgent">urgent</option>             </select>             </form></div>         <div style = "width: 50px; margin-left: auto; margin-right: auto; padding: 2px">         <input class = "buttons" type ="submit" name = "sub" value = "submit" id = "sub"></div>         <div id="result"></div>         </div>      </body> </html> 


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -