I am making a program that would post on a webpage, to submit the form it has to "click" on a button:
<button class="form" type="submit">Send</button>
From what I know (not much) to submit a POST request when it's INPUT you must do name=value, but I don't know how I could do that with a submit button.
Basically I want to know what I must POST to the website so that it submits the form :p
Using submit buttons<input type="submit"> buttons are used to submit forms. If you want to create a custom button and then customize the behavior using JavaScript, you need to use <input type="button"> , or better still, a <button> element.
If you don't have any submit button it is acceptable after all it is an element of form tag and if it is not required you may not add it with in form .
You can tie a submit button to a form that the button doesn't live inside of. The trick is to give the form an id and then reference that id with the button's form property. With this setup, clicking the Submit button will cause the form to be submitted.
input suggests that the control is editable, or can be edited by the user; button is far more explicit in terms of the purpose it serves. Easier to style in CSS; as mentioned above, FIrefox and IE have quirks in which input[type="submit"] do not display correctly in some cases.
Here's basic syntax for a form:
<form>
<input name="name" type="text"/>
<button type="submit"> Send </button>
</form>
Whatever backend you are using should be able to read POST request parameter "name" to read what that form contains.
If you're trying to make a form with just that one button, you can do that by just skipping that input
element. Of course, there will be no data in that post request, but you can add the action
attribute to the containing form and set it equal to a URL where you would like to redirect the user on button click.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With