Home > Web Front-end > HTML Tutorial > How to create a form using HTML to send

How to create a form using HTML to send

不言
Release: 2018-11-21 09:45:53
Original
3381 people have browsed it

In addition to the language for displaying characters and images, HTML actually also has the function of creating simple forms. This article will share with you how to use HTML format to create a sending form.

Let’s first explain the form elements: The form element is a necessary element to create a submission form.

The basic format is as follows:

<form action =""method ="">
  //填写表单的内容
</ form>
Copy after login

In fact, although it does not display an input form that only uses form elements for imaging, it can be done by placing such input attributes in the form section to display the form.

The form element is an image, such as a label for sending an order by putting parts together.

Having said this, the form may still not be clear enough. Let’s take a look at the specific content.

action attribute

The action attribute is used to specify the location where the data is sent after the form is sent.

Example:

Specified as an external URL

We send the form data to the URL (//m.sbmmt.com/)

<form action ="//m.sbmmt.com/">
Copy after login

Specified as an internal URL

Send form data to form.php for processing at the location added to the end of the current URL.

<form action ="form.php">
Copy after login

Unspecified

Send form data to the current URL.

<form>
Copy after login

method attribute

Specify the role of the method attribute and the sending method when sending the form.

Common transmission methods are POST and GET.

Let’s look at a specific example

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
	<title></title>
</head>
<body>
<form action="" method="">
  <div>
    <label for="message">message:</label>
    <br>
    <input type="text" />
  </div>

  <div class="button">
    <button type="submit">发送消息</button>
  </div>
</form>
</body>
</html>
Copy after login

The effect is as follows:

How to create a form using HTML to send

Explanation: In the above code, form is a Large label; below is label, which can be set on the form. This time, a message label is generated. Next is the input tag, which can be used to generate input forms; and finally button, which is a tag that can generate buttons.

The above is the detailed content of How to create a form using HTML to send. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template