I have a form with two input type=text
fields outside the form tags. I’m using the HTML5 form attribute on the input fields. In my PHP $_POST
I get the original values, regardless of what I type in the input
(09:00
and 13:00
in the example below).
I tried in both Chrome and Firefox, with the same result.
What am I doing wrong?
<table>
<tbody>
<tr>
<td>
28 Aug 2024 <input type="text" name="etd" value="09:00" form='41139'>
</td>
<td>
28 Aug 2024 <input type="text" name="eta" value="13:00" form='41139'>
</td>
<td>
<form action="itinerary.php" method="post" id="41139">
<input type="submit" name="submit" value="Save">
</form>
</td>
</tr>
</tbody>
</table>
2
Answers
this problem might be due to browser caching or how the "form" attribute is handled
Try disabling caching with
<meta http-equiv="Cache-control" control ="no-cache">
you can use JavaScript to ensure the update value are submitted
as mplungjan pointed in his comments :
1 – it could be an issue of a numeric ID -> change
id="41139"
toid="f41139"
2 – NEVER call anything in a
form.name
orform.id
submit