form name form of action

The Form of name: The name attribute is used to submit the form data to the server identified 
Note: Only set the name attribute of the form element in order to pass their value when the form is submitted. 
Simply put, name is submitted to index the background, for example, should be set in the check box to name = " Hobby " explained a few check boxes are under hobby.

 

How to (1) name groups:

  It has the same name attribute for the same set of radio

 <lable>性别</lable>
 <input type="radio" name="sex" value="man"><input type="radio" name="sex" value="woman"><lable>取向</lable>
 <input type="radio" name="sex1" value="man"><input type="radio" name="sex1" value="woman">女

(2)get和post的区别
. 1 . The data obtained after GET attached url (the data is placed in the header http protocol), to? Url split and transmit data to & parameter between connected. post is submitted the data is placed in the package body http packet.
2 . Data can only get so delivered is 1024 bytes. The post is no limit, you can transfer large amounts of date
 3 . Security post is higher than the safety of get. For example: the data submitted by get, clear text username and password will appear on the url, login screen because there might be browser cache, others to view browser history can get your account and password. 
Further, get one kind of requests for sending data to the server, post a request is submitted to one kind of data to the server.

 

(3) Other supplements

  1. role form form
    form for submitting user input data to the backend
    <form name = "myForm" Action = "" method = "GET"> </ form>
    name: the name when the form is submitted
    action: submitted to the address
    method : submission, get and post (default is get)

  2. The difference between post and get the way

  • Different data exchange, get makes the submitted data can be seen in the url (url contains data submitted), post see;

     

     

     
  • get small amount of data is generally used to submit (large amount of data is then returned back), post used to submit a large amount of data (a small amount of data is then returned back);
  • get up to 1k submit data, restricted the browser (the browser address bar enter limit of no more than 1k). post theoretically unlimited, subject to server restrictions;
  • Get the data submitted in the browser history, poor security
  1. Commonly used input tag
  • type = "text":
    for entering text.
    <input name = "username" type = "text" placeholder = " User Name" MAXLENGTH = 10 />
    placeholder attributes (optional) is shown in box prompts, maxlength (optional) limit the maximum input length;
  • type = "password":
    for a password, enter the contents are displayed as asterisks.
    <input name = "password" type = "password" placeholder = " Password" />
  • type = "radio":
    radio circle button. Note: name you want to achieve the same radio, value must be value.
    <input type = "radio" name = "sex" value = "male" /> M
    <input type = "radio" name = "sex" value = "female" /> Women
  • type = "checkbox":
    check box. Plus checked property will default to the last election. Submitting, if selected (e.g. Bike), then ON = Bike
    <INPUT type = "CheckBox" name = "Bike" the checked /> Cycling
    <input type = "checkbox" name = "car" /> Cars
  • type = "hidden":
    hidden fields, invisible to the user, data is temporarily stored. Security check or
    <INPUT name = "url_delete" type = "hidden" value = "/ delete.php" />
    <INPUT name = "csrf_token" type = "hidden" value = "a23dafd23444" />
  1. input in, name of the role
    name to the form name, which tells the server to submit the form data.
    The name attribute must have, otherwise unable to submit form data to the server.

  2. type = hidden hidden field effect
    hidden field in the page is not visible to the user, is inserted into a hidden field in the form object to collect or transmit information, to facilitate the process the form is used by the program. When viewers click the Send button to send the form, the hidden field information is also sent to the server together.

Sometimes we give the user a message that he should submit up when the form is submitted in order to determine the identity of the user, such as sessionkey, and so on. Of course, these things can be achieved cookie, but the use of hidden fields on more simple. And will not have browser does not support, users disable cookie troubles.

Sometimes there are more than a form submit button, how to make the program user is able to distinguish in the end that a press submit button it up? We can write a hidden field, and then add a button onclick in every place = "document.form.command.value =" xx "after" Then we check the data received command value is based on the user will know that button to submit up.

Sometimes there is more than a web page form, we know more form is not submitted at the same time, but sometimes these interactions form indeed, we can add hidden fields in the form to make them linked.
javascript does not support global variables, but sometimes we have to use global variables, we can hide the value of pre-existing domain, its value will not be lost.

There example, such as pressing a button to pop up four small windows, when you click a small window in which the other three shut down automatically. But IE does not support widgets call each other, so only write a hidden field in the parent window, when a small window to see the value of the hidden field is close to switch off their own.

  1. <Button> submit </ button>, <a class="btn" href="#"> submit </a>, <input type = "submit" value = "Submit"> three What is the difference?
  • <button> submitted </ button>
    is merely a button and not submitted directly form data function
  • <a class="btn" href="#"> submit </a>
    if the link href js file for submission of data, you can achieve data submitted
  • <input type = "submit" value = " submit">
    is a form submission, the package has a default style


 

 

 

 

 

 

.

Guess you like

Origin www.cnblogs.com/jianxian/p/12240932.html