Smarty How to generate simple form elements

Source: Internet
Author: User
Tags smarty template
This article mainly introduces the method of Smarty simple form elements, involving the Smarty template file operation of the relevant skills, the need for friends can refer to. We hope to help you.

Specific 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

<select name=customer_id onkeypress= "" ><{html_options values= $cust _ids selected= $customer _id output= $cust _ NAMES}></SELECT><HR/><{html_radios name= "id" values= $cust _ids selected= $customer _id output= $cust _names}>

Related recommendations:

Smarty template engine Video teaching materials course recommendation

How PHP built-in functions are shared by instances invoked in Smarty

What are the PHP smarty template operators? How is the operator used?

Related Article

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.