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>