Example of how to generate a simple form element using Smarty form _ PHP

Source: Internet
Author: User
Smarty is a simple method example for generating form elements. it is a smarty form. A simple example of how Smarty generates form elements. this example describes how smarty simply generates form elements. For your reference, the smarty form is used as an example to generate a simple form element.

This example describes how to generate a simple form element by using Smarty. We will share this with you for your reference. The details are as follows:

The implementation principle of the form element generation function of smarty is: to generate and display menus or options for smarty, and to pass the value of an option for matching by default:

Example:

Php file: index. php

<? Php include ("smarty_inc.php"); $ smarty-> assign ('cust _ id', array (,); $ smarty-> assign ('cust _ names ', array ('Ding qing', 'Lei Lei ', 'ludong', '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: We recommend several formatting, beautification, and conversion tools on this site to help you sort out messy code. I believe you can use them in future development:

Php code online formatting and beautification tools:
Http://tools.jb51.net/code/phpformat

JavaScript code beautification/compression/Formatting/encryption tools:
Http://tools.jb51.net/code/jscompress

Online XML formatting/compression tools:
Http://tools.jb51.net/code/xmlformat

JSON code formatting and beautification tools:
Http://tools.jb51.net/code/json

Online XML/JSON conversion tools:
Http://tools.jb51.net/code/xmljson

Json code online Formatting/beautification/compression/editing/conversion tools:
Http://tools.jb51.net/code/jsoncodeformat

SQL code online formatting and beautification tools:
Http://tools.jb51.net/code/sqlcodeformat

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.