HTML <button> formmethod attribute

Definition and usage

formmethod The attribute specifies the HTTP method used to send form data. This attribute overrides the form's method attribute.

formmethod The attribute is only used for type="submit" button.

Form data can be sent as URL variables (using method="get"), or sent as an HTTP post (using method="post")

Notes on the "get" method:

  • It attaches form data to the URL in the form of name/value pairs
  • This is very useful for form submissions where users want to add the results as bookmarks
  • The amount of data that can be placed in the URL is limited (varies by browser), so it cannot be guaranteed that all form data can be transmitted correctly.
  • Never use the "get" method to pass sensitive information! (Passwords or other sensitive information will be displayed in the browser's address bar)

Notes on the "post" method:

  • It sends form data as an HTTP POST transaction
  • Forms submitted using the "post" method cannot be saved as bookmarks
  • Compared to the "get" method, the "post" method is more robust and secure
  • It has no size limit

Example

Form with two submit buttons. The first submit button submits form data using method="get", and the second submit button submits form data using method="post":

<form action="/action_page.php" method="get">
  <label for="fname">Hausa name:</label>
  <input type="text" id="fname" name="fname"><br><br>
  <label for="lname">Hausa name:</label>
  <input type="text" id="lname" name="lname"><br><br>
  <button type="submit">پیشکش کریں</button>
  <button type="submit" formmethod="post">پوسٹ کے ذریعے استفادہ کریں</button>
</form>

ذاتی طور پر کوشاں

قواعد

<button type="submit" formmethod="get|post">

پیراگراف کا حصہ

قیمتی وصف
گیٹ فرم کے اعداد کو یورل میں شامل کریں:یورل?نام=قیمتی&نام=قیمتی
پوسٹ فرم کے اعداد کو ایچ ٹی پی پوسٹ معاملے کے طور پر بھیج دیا جاتا ہے۔

براوزر سپورٹ

میں دوسرے براوزرز کی پہلی کامپٹیبل ورژن کی شمارش کی گئی ہیں۔

کروم ایج فائرفاکس سافری آپریا
کروم ایج فائرفاکس سافری آپریا
9.0 10.0 4.0 5.1 15.0

تعلیمات:formmethod پیراگراف کا حصہ HTML 5 میں نئی حصہ ہے。