Thuộc tính hành động <form> HTML

❮ Thẻ <form> HTML

Thí dụ

Khi gửi, hãy gửi dữ liệu biểu mẫu đến một tệp có tên "action_page.php" (để xử lý đầu vào):

<form action="/action_page.php" method="get">
  <label for="fname">First name:</label>
  <input type="text" id="fname" name="fname"><br><br>
  <label for="lname">Last name:</label>
  <input type="text" id="lname" name="lname"><br><br>
  <input type="submit" value="Submit">
</form>

Định nghĩa và Cách sử dụng

Thuộc actiontính chỉ định nơi gửi dữ liệu biểu mẫu khi biểu mẫu được gửi.


Hỗ trợ trình duyệt

Attribute
action Yes Yes Yes Yes Yes

Cú pháp

<form action="URL">

Giá trị thuộc tính

Value Description
URL Where to send the form-data when the form is submitted.

Possible values:

  • An absolute URL - points to another web site (like action="http://www.example.com/example.htm")
  • A relative URL - points to a file within a web site (like action="example.htm")

❮ Thẻ <form> HTML