Detailed explanation of HTML calling PHP

小云云
Release: 2023-03-22 14:22:02
Original
3538 people have browsed it

This article mainly shares with you the detailed explanation of HTML calling PHP.

html itself cannot handle dynamic requests. To complete this, javascript is usually used . When generating a static web page in , you can generate a corresponding javascript file reference for the html page based on the database ID. For example, the page is 123.html, Then generate a

<script type="text/javascript" src="click.php?id=123"></script>
Copy after login

on this page and then click.php This page just needs to process and operate the database according to the syntax of PHP.

============================================== ==

You cannot directly call php files in static pages, but you can use js calling method to call php files, and you can also use ajax to call php files.
Give a simple example to illustrate: Use the following code in page a.html to pass the action=test parameter to b.php.
Javascript code is as follows:

<script type="text/javascript" src="b.php?action=test"></script>
Copy after login


There is such a PHP code in b.php:

<?php 
$action=$_GET[&#39;action&#39;];     
echo "document.write(&#39;".$action."&#39;);n";    
?>
Copy after login

========= ===============================

Related recommendations:

How HTML calls PHP

How static html calls PHP files

How to implicitly call PHP programs_PHP tutorial

The above is the detailed content of Detailed explanation of HTML calling PHP. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!