Smarty example of a simple way to generate form elements, smarty form _php Tutorial

Source: Internet
Author: User
Tags php template smarty template

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 ...

  • 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.