How to insert HTML code blocks in PHP

Source: Internet
Author: User
I use PHP to query records from MySQL and then want to display different fields in different text in the form, and update the data.
Want to insert a more complex form, with ECHO is too error-prone, you big God, there is no other way to achieve ah, kneel beg!


Reply to discussion (solution)

Package good one a small function, the face of interface programming is simple.

The form code is statically written in a PHP file, and the PHP code outputs the queried data as a JS object, and then the DOM operation assigns values to the form elements, for example:

 
  Untitled Document

 
  Untitled Document

Dizzy.. I complicate the simple question again. Output large pieces of HTML code can do this:

$ar = Array (' demo ' = ' 111 ', ' test ' = ' 222 '); $html = <<
 
   
   

Well, thank you, man. I also need the answer to this question. hehe

You can consider a template, such as Smarty

PHP code
$ar = Array (' demo ' = ' 111 ', ' test ' = ' 222 ');
$html = <<




Halo. I complicate the simple question again. The output large segment HTML code can do this:
PHP code
$ar = Array (' demo ' = ' 111 ', ' test ' = ' 222 ');
$html = <<


useful posts, helpful

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