-1
have input with name contributor inside the while:
while($rows_cursos = mysqli_fetch_array($resultado_cursos)) {
$tabela1 .= '<tr>';
$tabela1 .= '<td>'.$rows_cursos['nome'].'</td>';
$tabela1 .= '<td> <input type="text" name= "Colaborador" value=""</td>';
Within the value
I want to make a query of the employees' table and create a combo with the names of all employees, so they only have to select their name instead of writing.
Within the value
I wanted to do like this I did in select
:
<label for=""><h5><strong>Colaborador</strong></h5></label>
<select name="Colaborador" required>
<option></option>
<?php
$servername = "xxx.xxx.x.xx";
$username = "xxxx";
$password = "xxxxxx";
$dbname = "xxxxxx";
$conn = new mysqli($servername, $username, $password, $dbname);
$conn->set_charset('utf8');
$sql = "SELECT * FROM centrodb.colaboradores WHERE descricaovalencia = 'lar' AND estado = 1 AND Funcao = 'AAD' ORDER BY nome ASC";
$qr = mysqli_query($conn, $sql);
while($ln = mysqli_fetch_assoc($qr)){
echo '<option value="'.$ln['nome'].'">'.$ln['nome'].'</option>';
}
?>
</select>
I solved the problem this way:
<td WIDTH="80" align="center"> <select name="Colaborador" id="Colaborador">
<option></option>
<option value="1">teste</option>
</select></td>';
Instead of Using a input
I used the select
.
Man, I don’t quite understand what you want to do?
– Woton Sampaio
You want to use the $rows_corsos['name'] field to make a new query?
– Woton Sampaio
I already edited the question and showed what I wanted to do inside the
value
, like what I do inside theselect
– Bruno
What you want is not possible, you can simply replace your input text with the input select, what would make it easier would be wanted your input select in a variable before mounting the table, then in place in the input text.
– marcelogribeiro
Take a look there
– Woton Sampaio
@marcelogribeiro, can put an example?
– Bruno