Skip to content

Adding POST parameters after form submit

I have this form:

<form name="form" action="course_submit.php" onsubmit="return validateForm()" method="post">
...
</form>

And I’d like to add a few json arrays to POST in validateForm() after validation, so that when validateForm() returns true, the updated POST will be sent to course_submit.php. What’s the best wya to go about this? Thanks!

Answer

Have <input type="hidden" ...> elements inside the form.

Assign the values to those elements.