Smarty example of a simple method of generating a FORM element, Smarty form
This article describes a simple way to generate form elements smarty. Share to everyone for your reference, as follows:
Smarty the ability to generate form elements is implemented by giving Smarty an array for generating and displaying menus or options, and also for passing an option value for the default selection of matches:
Examples are as follows:
PHP File: index.php
<?php include ("smarty_inc.php"), $smarty->assign (' Cust_ids ', Array (1000,1001,1002,1003)); $smarty->assign (' Cust_names ', Array (' Dingqing ', ' Len Lei ', ' lvdong ', ' Song Zijian ')), $smarty->assign (' customer_id ', 1003); $smarty->display (" Index.html ");? >
Template file: index.html
<{html_options values= $cust _ids selected= $customer _id output= $cust _names}>
<{html_radios name= "id" values= $cust _ids selected= $customer _id output= $cust _names}>
PS: Here are recommended several of the site's formatting/beautification/conversion tools can help you tidy up the messy code, I believe that you can use in future development:
PHP Code online format Beautification tool:
Http://tools.jb51.net/code/phpformat
JavaScript code beautification/compression/formatting/encryption Tools:
Http://tools.jb51.net/code/jscompress
Online XML format/compression tool:
Http://tools.jb51.net/code/xmlformat
JSON Code formatting beautification tool:
Http://tools.jb51.net/code/json
Online Xml/json Mutual Conversion tool:
Http://tools.jb51.net/code/xmljson
JSON code online formatting/landscaping/compression/editing/conversion tools:
Http://tools.jb51.net/code/jsoncodeformat
SQL code online Format beautification tool:
Http://tools.jb51.net/code/sqlcodeformat
More interested in smarty related content readers can view the topic: "Smarty Template Primer Basic Tutorial", "PHP Template Technology Summary", "PHP based on PDO Operation Database Skills summary", "PHP operation and operator Usage Summary", "PHP Network Programming Skills Summary", " PHP Basic Grammar Introductory tutorial, PHP Object-oriented Programming primer, PHP string usage Summary, PHP+MYSQL database Operations Primer and PHP Common database operations Tips Summary
It is hoped that this article will be helpful to everyone based on smarty template PHP program design.
http://www.bkjia.com/PHPjc/1133101.html www.bkjia.com true http://www.bkjia.com/PHPjc/1133101.html techarticle Smarty An example of a simple method of generating a FORM element, the Smarty form describes smarty simple ways to generate form elements. Share to everyone for your reference, as follows: Smarty Sheng ...