ข้อมูลอ้างอิงHTML

HTML โดยตัวอักษร HTML ตามหมวดหมู่ รองรับ HTML Browser แอตทริบิวต์ HTML HTML Global Attributes เหตุการณ์ HTML HTML สี HTML Canvas HTML เสียง/วิดีโอ ชุดอักขระ HTML HTML Doctypes การเข้ารหัส URL HTML รหัสภาษา HTML รหัสประเทศ HTML ข้อความ HTTP วิธี HTTP ตัวแปลง PX เป็น EM แป้นพิมพ์ลัด


HTML <form> แอตทริบิวต์การกระทำ

❮ แท็ก HTML <form>

ตัวอย่าง

เมื่อส่ง ให้ส่งข้อมูลแบบฟอร์มไปยังไฟล์ชื่อ "action_page.php" (เพื่อประมวลผลอินพุต):

<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>

ความหมายและการใช้งาน

actionแอตทริบิวต์ที่ระบุว่าจะส่งแบบฟอร์มข้อมูลเมื่อส่งแบบฟอร์ม


รองรับเบราว์เซอร์

Attribute
action Yes Yes Yes Yes Yes

ไวยากรณ์

<form action="URL">

ค่าแอตทริบิวต์

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")

❮ แท็ก HTML <form>