How to implement the method of triggering PHP with button click of html?

I have an .html file:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>test03</title>
</head>
<body>

<button>
    test03
</button>
    
</body>
</html>

can I write Php code in this .html? If not, then I want to click the button button to trigger a php event. What can I do?

Mar.28,2021

  1. your file is a html file, you cannot write php code.
  2. to write php, in html code, you need to change the file type to .php .
  3. triggering the php event means clicking on the button and then initiating a request, right? Give me a simple demo,. I don't know if I can help you.
$('button').click(function(){
    $.post("test.php", {}, function(data) {
      console.log(data);
    });
})

request a php event. Button sets submit


1.PHP has no event, and the event is the front-end thing
2. The front end and the back end run in different environments and cannot produce any association. The only way to interact is to request
3 through the network. Baidu jquery ajax

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3deb3-2b91b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3deb3-2b91b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?