Home  >  Article  >  Backend Development  >  How to implement the default selection of php select, radio and checkbox_PHP tutorial

How to implement the default selection of php select, radio and checkbox_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:37:13884browse

This is the implementation method of extending the default selection of yibing's select

Copy the code The code is as follows:

< ;select name="wuyeleixing" size="1">














The default selection implementation of the radio radio button
Copy code The code is as follows:

>Blank
>Assignment
>Transfer
>Collective

checkbox checkbox default selection implementation
Copy code The code is as follows:

>furniture
< ;strong>name="fujia_chuju" type="checkbox" value="chuju" >Kitchenware
name="fujia_woju" type="checkbox" value="woju" >Bedding
name="fujia_TV" type="checkbox" value="TV" >TV

The combined use of these form fields is suitable for modifying some databases Record, and keep the original record the same as when you added it!

select is selected by default, select gets the selected item

Well, I have to admit that my JS is so bad, I can only understand a few lines of code sometimes. Difficulties arise. For example, today it took me nearly half an hour to solve the problem of default selection in the front-end select. The code I finally found is quite simple to solve the problem of selecting and obtaining selected items. It is still very difficult to use this JS to solve the selection of HTML select. It is effective. I think the solution selected is worth keeping and sharing with friends. The code is as follows:

Copy code The code is as follows: