How Smarty generates simple form elements

*文
Release: 2023-03-18 21:04:01
Original
1322 people have browsed it

This article mainly introduces the method of Smarty to simply generate form elements, and involves the related skills of Smarty template file operation. Friends in need can refer to it. I hope to be helpful.

The details are as follows:

The principle of smarty generating form element function is: give smarty an array to generate and display menus or options, and pass the value of an option for default Selected matches:

Examples are as follows:

php file: index.php

assign('cust_ids',array(1000,1001,1002,1003)); $smarty->assign('cust_names',array('丁庆','闫磊','吕东','宋子健')); $smarty->assign('customer_id',1003); $smarty->display("index.html"); ?>
Copy after login

Template file: index.html

 
<{html_radios name="id" values=$cust_ids selected=$customer_id output=$cust_names }>
Copy after login

Related recommendations :

Smarty template engine video teaching material course recommendation

How about php built-in functions Sharing examples of calling in smarty

php What are the smarty template operators? How to use operators?

The above is the detailed content of How Smarty generates simple form elements. 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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!