Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

239
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!