In advance, thanks for your help.
I am trying to make a form in which, when selecting an option in a combobox, take the selected value and can put together a query to insert a value into an input text. I'm stuck on how to put the value of the combobox in a variable and thus be able to arm my query. (the part of the connection to the base and how to call the cosulta I have defined, I just need to get the value to integrate it). This is my code
<?php
$db_host="localhost";
$db_nombre="herramienta";
$db_usuatio="root";
$db_contra="";
$conexion=mysqli_connect($db_host,$db_usuatio,$db_contra,$db_nombre);
$consulta_tec="SELECT * FROM tecnicos ";
$consulta_sup="SELECT * FROM supervisores ";
$consulta_pro="SELECT * FROM proyectos ";
$consulta_suc="SELECT * FROM sucursales ";
$list_tecnico=mysqli_query($conexion, $consulta_tec);
$list_sup=mysqli_query($conexion, $consulta_sup);
$list_pro=mysqli_query($conexion, $consulta_pro);
$list_suc=mysqli_query($conexion, $consulta_suc);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
<script
src="https://code.jquery.com/jquery-3.3.1.js"
integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
crossorigin="anonymous"></script>
</head>
<body class="oneColElsCtrHdr">
<center><div id="container">
<div id="header">
<h1>Despacho de Ingenieros</h1>
<!-- end #header --></div>
<div id="mainContent">
<form name="form1" method="POST" action="">
<table width="200" >
<tr>
<td>Fecha</td>
<td><label>
<input type="text" name="fecha" id="fecha">
</label></td>
</tr>
<tr>
<td>Hora de Inicio</td>
<td><label>
<input type="text" name="inicio" id="inicio">
</label></td>
</tr>
<tr>
<td>Hora Final</td>
<td><label>
<input type="text" name="fin" id="fin">
</label></td>
</tr>
<tr>
<td>Tiempo real</td>
<td><label>
<input type="text" name="real" id="real">
</label></td>
</tr>
<tr>
<td>Tecnico</td>
<td><label>
<select name="tecnico" id="tecnico" value="" ><option
selected="" value="">[Seleccione a un tecnico]</option>
<?php
while ($fila_tec=mysqli_fetch_array($list_tecnico)){
echo "<option value='". $fila_tec["Id"] ."'>"
.$fila_tec["Nombre"] ."</opiton>";
}
?>
</select>
</label></td>
</tr>
<tr>
<td>Supervisor</td>
<td><label>
<select name="supervisor" value=""><option selected="" value="">
[Selecciones a un supervisor]</option>
<?php
while ($fila_sup=mysqli_fetch_array($list_sup)){
echo "<option value='". $fila_sup["Id"] ."'>"
.$fila_sup["Nombre"] ."</opiton>";
}
?>
</select>
</label></td>
</tr>
<tr>
<td>Proyecto</td>
<td><label>
<select name="proyecto" id="proyecto"
onchange="ShowSelected()" value=""><option selected="" value="" >[Seleccione
un proyecto]</option>
<?php
while ($fila_pro=mysqli_fetch_array($list_pro)){
echo "<option value='". $fila_pro["Acronimo"] ."'>"
.$fila_pro["Acronimo"] ."</opiton>";
}
?>
</select>
</label></td>
</tr>
<tr>
<td>Tiempo Proyecto</td>
<td><label>
<input type="text" name="tiempo" id="tiempo" value="<?php echo
$user;?>" >
</label></td>
</tr>
<tr>
<td>Sucursal</td>
<td><label>
<select name="sucursal" value=""><option selected="" value="">
[Selecciones a un sucursal]</option>
<?php
while ($fila_suc=mysqli_fetch_array($list_suc)){
echo "<option value='". $fila_suc["SIRH"] ."'>"
.$fila_suc["Nombre"] . "</opiton>";
}
?>
</select>
</label></td>
</tr>
<tr>
<td>Cd Origen</td>
<td><label>
<input type="text" name="cdorigen" id="cdorigen">
</label></td>
</tr>
<tr>
<td>KM</td>
<td><label>
<input type="text" name="km" id="km">
</label></td>
</tr>
<tr>
<td>Division</td>
<td><label>
<input type="text" name="division" id="division">
</label></td>
</tr>
<tr>
<td>Zona</td>
<td><label>
<input type="text" name="zona" id="zona">
</label></td>
</tr>
<tr>
<td>SIRH</td>
<td><label>
<input type="text" name="sirh" id="sirh">
</label></td>
</tr>
</table>
<p> </p>
</form>
<h1> </h1>
<h2> </h2>
<p> </p>
</div>
<div id="footer">
<p>Pie</p>
</div>
</div></center>
It's my first attempt at php so I apologize for the obvious mistakes I made.
Greetings and thanks again!