I would like to update a sql table with a html form. I would like to select the element with a drop-down list and later update the values with the form.
Here is my code, the drop-down list and the form works, but I didn't know how to make that the php code get the element that I select.
HTML form:
 <?php
           require("conectarBD.php");
           $select = "SELECT id_serie, nombre FROM series";
           $result = $conectar->query($select);
           ?>
           Selecciona la serie que quieres modificar:
           <br>
           <select>
               <?php    
               while ( $row = $result->fetch_array() )    
               {
                   ?>
                   <option value=" <?php echo $row['id_serie'] ?> " >
                   <?php echo $row['nombre']; ?>
                   </option>
                   <?php
               }    
               ?>
           </select>
           <form action="modificar_serie.php" method="post">
           <p>
              Introduce los cambios a realizar:
           </p>
           <p>
            <label for="textfield">Nombre</label>
            <input type="text" name="nom" id="nom" />
            <label for="textarea"></label>
          </p>
          <p>
            <label for="textfield">Temporadas</label>
            <input type="number" name="temp" id="temp" />
            <label for="textarea"></label>
          </p>
          <p>
            <label for="textfield"> Año de estreno</label>
            <input type="text" name="est" id="est" />
            <label for="textarea"></label>
          </p>
           <input type="Submit" value="Actualizar">
           </form>
PHP:
    <?php
 require("conectarBD.php");
 $nombre = $_POST["nombre"];
 $temp = $_POST["temp"];
 $est = $_POST["est"];
 $query="UPDATE series SET nombre = '.$nombre.', temporadas = '.$temp.', estreno= '.$est.' WHERE nombre='$nombre'";
 mysqli_query($conectar,$query);
     if(mysqli_affected_rows()>=0){
    echo "<p>($nombre) Datos Actualizados<p>";
     }else{
    echo "<p>($nombre) No se ha podido actualizar en estos momentos<p>";
     }
    header("Location: ../index.php");
?>
 
    