How can I transfer the variable value calculated in a php file to another html file?

Source: Internet
Author: User
For example, the PHP file {code...} has a problem. How to upload this $ a to another html file. The position of $ a in the following p tag shows {code...} for example:
Php file

// Read database information $ SQL = "select * from message order by id desc"; $ query = mysql_query ($ SQL ); // capture a value in the array and save it to $ a $ row = mysql_fetch_array ($ query); $ a = $ row [1];

Now the problem is coming. How to upload this $ a to another html file. The position of $ a in the following p tag is displayed:

$ A value: $

Reply content:

For example:
Php file

// Read database information $ SQL = "select * from message order by id desc"; $ query = mysql_query ($ SQL ); // capture a value in the array and save it to $ a $ row = mysql_fetch_array ($ query); $ a = $ row [1];

Now the problem is coming. How to upload this $ a to another html file. The position of $ a in the following p tag is displayed:

$ A value: $

Another HTML file must be a PHP file. Directly echo the request:

require 'view.php';

View. php content:

$ A value:

Of course, you can also read the content of a pure static HTML page and directly execute this section. This is basically the case for various template engines.

You can directly write html to the PHP file. why do you want to upload it?

Zookeeper has two types of routes: server or client.

The template engine is the actual component of the server. PHP itself is a template engine, so it can be realized by embedding the PHP used to fetch data into the object HTML, the premise is that you can change the HTML file to the PHP parser or directly register the file. php.

The essence of client-side scripting is ajax. Please calculate and manually present this document.

A. php:

// Read database information $ SQL = "select * from message order by id desc"; $ query = mysql_query ($ SQL ); // capture a value in the array and save it to $ a $ row = mysql_fetch_array ($ query); $ a = $ row [1];

B. php:


  

$ A value:

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.