Is there anyway to submit a POST variable, with name, to another page? I.e. form submission, as IF a button were clicked, but without having to click a button.
2 Answers
There are many ways to do this - the easiest, library-free method probably being something like:
If your HTML looks like this (has at least the id, method, and action attributes)
<form id="myForm" method="post" action="post-target.php">
<input type="hidden" name="username" value="username" />
</form>
You can submit the form via javascript like this:
myForm = document.getElementById('myForm');
myForm.submit();
1 Comment
Steven Matthews
Yes, but I want the specific information contained in the button to be sent, too. I.e. I want to send a POST variable with the name "del" over to another page.