: This article describes how to use the Activeform component of YII20. For more information about PHP tutorials, see. This article describes how to use the Activeform component of YII2.0. We will share this with you for your reference. The details are as follows:
Activeform
Text box: textInput ();
Password box: passwordInput ();
Single region: radio (), radioList ();
Check box: checkbox (), checkboxList ();
Drop-down box: dropDownList ();
Hidden Field: hiddenInput ();
Text field: textarea (['rows '=> 3]);
File upload: fileInput ();
Submit button: submitButton ();
Reset Button: resetButtun ();
<? Php $ form = ActiveForm: begin (['action' => ['test/getpost'], 'method' => 'post',]);?> <? Echo $ form-> field ($ model, 'Username')-> textInput (['maxlength' => 20])?> <? Echo $ form-> field ($ model, 'password')-> passwordInput (['maxlength' => 20])?> <? Echo $ form-> field ($ model, 'sex')-> radioList (['1' => 'male', '0' => 'female])?> <? Echo $ form-> field ($ model, 'edu')-> dropDownList (['1' => '', '2' => 'High School ', '3' => 'Junior High School'], ['propt' => 'Select ', 'Style' => 'width: 120px'])?> <? Echo $ form-> field ($ model, 'file')-> fileInput ()?> <? Echo $ form-> field ($ model, 'hobby')-> checkboxList (['0' => 'Basketball ', '1' => 'soccer ', '2' => 'Badminton ', '3' => 'table tennis'])?> <? Echo $ form-> field ($ model, 'info')-> textarea (['rows '=> 3])?> <? Echo $ form-> field ($ model, 'userid')-> hiddenInput (['value' => 3])?> <? Echo Html: submitButton ('submit', ['class' => 'btn btn-primary ', 'name' => 'Submit-click'])?> <? Echo Html: resetButton ('reset ', ['class' => 'btn btn-primary', 'name' => 'Submit-click'])?> <? Php ActiveForm: end ();?>
I hope this article will help you design PHP programs based on the Yii Framework.
The above describes how to use the form component of the YII20 Activeform, including some content, and hope to help friends who are interested in the PHP Tutorial.