Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

117
Vistas
"hidden" type input value, not being send correctly via $_POST

I was wondering why I am not sending the value of the hidden input? After the browser executes the following code, I actually get the desired ID in the value tag - see the image here.

if (mysqli_num_rows($allStreets) > 0) {
  while ($display = mysqli_fetch_assoc($allStreets)){
    echo <<< HEREDOC
    <form action="allHouses.php" method="post">
      <table class='table table-striped'>
        <tr>
          <td align="left">
            {$display["name"]}
          </td>
          <td align="right">
            <input type="submit" class="btn btn-success" name="street" value="Go to all houses on this street">
            <input type="hidden" name="id" value"{$display['id']}">
          </td>
        </tr>
      </table>
    </form>
HEREDOC;
  }
} else {
  echo "No streets found";
}

And then I have a php code that doest the following:

if (isset($_POST['id'])) {
  echo var_dump($_POST['id']);
  echo "set";
} else {
  echo "not set";
}

And the output from the var_dump() is: string(0) "" set. Not 2 as I expect.
My question is why it is not holding the ID? And how could this be fixed? Thank you!

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You're missing = in value.

change this

value"{$display['id']}"

with this:

value="{$display['id']}"
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda