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

238
Vistas
assign value of a js variable to a php variable and then use in html form field

In a HTML form a date is selected in field with name manufacture_one

When the button is clicked the js function showEndDate() is triggered. The value entered in field with id myTextInputID is assigned to js variable. I have tested that the date entered in the form is displayed in an alert box.

I am trying to assign this variable to php variable and use it as an upper limit in the field with name end_date

      <div>
      <div id="standardPanel">*Task / Person: <input type="text" name="product" required ></div>
      <div id="standardPanel">*Description: <input type="text" name="customer" required ></div>
      <div id="standardPanel">*Date: <input id="myTextInputID" type="date" name="manufacture_one" required ></div>
      <p class="flip" onclick="showEndDate()">Click to add End Date</p>
      <div id="panel">
        End Date: (holidays only) <input type="date" name="end_date" max='<?php echo $endDate; ?>'>
      </div>
      <div><input id="submit" name="action" type="submit" value="submit"/></div>
    </form>

    <script>
    function showEndDate() {
      document.getElementById("panel").style.display = "block";
      var inputValue = document.getElementById("myTextInputID").value;
      alert(inputValue);
      <?php $endDate = "<script>document.write(inputValue)</script>"?> 
    }
    </script>
about 4 years ago · Juan Pablo Isaza
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