Guest User

Untitled

a guest
Mar 22nd, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. while($rows_cursos = mysqli_fetch_array($resultado_cursos)) {
  2.  
  3. $tabela1 .= '<tr>';
  4.  
  5. $tabela1 .= '<td>'.$rows_cursos['nome'].'</td>';
  6. $tabela1 .= '<td> <input type="text" name= "Colaborador" value=""</td>';
  7.  
  8. <label for=""><h5><strong>Colaborador</strong></h5></label>
  9. <select name="Colaborador" required>
  10. <option></option>
  11. <?php
  12. $servername = "xxx.xxx.x.xx";
  13. $username = "xxxx";
  14. $password = "xxxxxx";
  15. $dbname = "xxxxxx";
  16.  
  17. $conn = new mysqli($servername, $username, $password, $dbname);
  18. $conn->set_charset('utf8');
  19.  
  20. $sql = "SELECT * FROM centrodb.colaboradores WHERE descricaovalencia = 'lar' AND estado = 1 AND Funcao = 'AAD' ORDER BY nome ASC";
  21. $qr = mysqli_query($conn, $sql);
  22. while($ln = mysqli_fetch_assoc($qr)){
  23. echo '<option value="'.$ln['nome'].'">'.$ln['nome'].'</option>';
  24. }
  25. ?>
  26. </select>
  27.  
  28. <select name="produto" id="Produto" onchange="javascript:associaInput();"*>
  29.  
  30.  
  31. function associaInput() {
  32. //pega o value do select
  33. var e = document.getElementById("Produto");
  34. var itemSelecionado = e.options[e.selectedIndex].value;
  35.  
  36. //injeta no value do input
  37. document.getElementByName('produto.Produto').value = itemSelecionado;
  38. }
  39.  
  40. <label for=""><h5><strong>Colaborador</strong></h5></label>
  41. <select name="Colaborador" required>
  42. <option></option>
  43.  
  44. <?php
  45.  
  46. $servername = "xxx.xxx.x.xx";
  47. $username = "xxxx";
  48. $password = "xxxxxx";
  49. $dbname = "xxxxxx";
  50.  
  51. $mysqli = new mysqli($servername, $username, $password, $dbname);
  52.  
  53.  
  54. if($th = $mysqli->query("SELECT * FROM centrodb.colaboradores WHERE descricaovalencia = 'lar' AND estado = 1 AND Funcao = 'AAD' ORDER BY nome ASC");
  55. whiel($row = $th->fetch_assoc()){
  56. echo '<option value="'.$row['nome'].'">'.$row['nome'].'</option>';
  57.  
  58. }
  59.  
  60. ?>
  61. </select>
Add Comment
Please, Sign In to add comment