简体   繁体   中英

Submit a form with a button (HTML)

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM