PHP form elements Introduction to the selection of field markers and text field markers

Source: Internet
Author: User
Tags php form
Select Domain Markers <select> and <option>

You can create a list or menu by selecting field markers <select> and <option>. The menu is used to save space, you can only see one of the menu options in normal state, click the Lower triangle button on the right to open the menu to see all the options. A list can display a certain number of options. If this amount is exceeded, the scroll bar appears automatically, and the viewer can view the options by dragging the scroll bar.

The syntax format is as follows:

<select name= "name" size= "value" multiple><option value= "value" selected> option 1</option><option Value= "value" > Options 2</option><option value= "value" > Options 3</option>.......<select>

The argument name indicates the name of the selected field; The parameter size represents the number of rows in the list; The parameter value represents the menu option value, the parameter multiple represents the display of the data as a menu, and the default displays the data as a list.

Select how domain markers <select> and <option> are displayed and examples are as follows:

1. List mode

<select name= "lag" id= "lag" ><option value= "0" selected>php</option><option value= "1" >JAVA& Lt;/option><option value= "2" >HTML5</option><select>

The results of the operation are as follows:

Description: Drop-down list box, the list can display a certain number of options by selecting the field markers <select> and <option>, and if this number is exceeded, the scroll bar appears automatically, and the viewer can view the options by dragging the scroll bar. The selected property is used to set the menu by default when it is selected.

Form <form> consists of form elements. Commonly used form elements have the following types of markup: Enter field markers <input>, select field markers <select> and <option>, type field markers <textarea>, and so on.

2. Menu Mode

<select name= "lag" id= "lag" multiple><option value= "0" selected>php</option><option value= "1" &G T Java</option><option value= "2" >HTML5</option><select>

The results of the operation are as follows:

Description: The Multiple property is used in menu lists <select> tags, and users who specify this option can use the SHIFT and CTRL keys to make multiple selections.

Hint: In the above description only gives the static menu Add method, but in the Web program development process, also can add the menu item dynamically through the Loop statement.

Text field Markers <textarea>

Text field marker <textarea> used to create multiple lines of text field, in which you can enter more text.

The syntax format is as follows:

<textarea name= "name" Rows=value cols=value value= "value" warp= "value" > .... Text content <textarea>

The parameter name represents the text field, and the parameter rows represents the number of lines in the text field, and the parameter cols represents the number of columns of the text field (rows and cols in bytes): The parameter value represents the default value for the Text field, and the parameter warp is used to set the display and delivery method, and the off table Shown does not wrap, the value of hard means that the automatic return of the line, the line tag is sent to the server together, the output will also wrap, the value of soft means that the automatic return of soft returns line, the newline tag will not be sent to the server, the output is still a column.

The values of the text field markers <textarea> are as follows:

<textarea name= "Remark" rows= "4" cols= "2" id= "remark" >  Please enter your introduction! <textarea>

Description: Text field, also multiprocessing line text box, edit Warp property for multiline text is automatically wrapped by default.

The following is a concrete example of the difference between the warp property hard and the soft line-break tag, as shown in the example code:

<! DOCTYPE html>

HTML tags when you get a string in a multiline edit, the line-wrapping tag is not displayed. The above example outputs the following result:

Note: The use of hard and soft line-break tags is not visible on the browser, only after submitting the form, select the browser "right-click/view page source" command to see the effect of the line break tag, or through the NL2BR () function to view after conversion.

The

form <form> consists of form elements. Common form elements have the following types of markup: input field marker <input>, select field Tag <select> and <option>, Text field marker <textarea> and so on. In the previous section, I introduced the input field tag <input> of the PHP form element. This section highlights the selection of field markers <select> and <option> and text field markers <textarea>.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.