PHPProgramming

How to Embed PHP programming Language in HTML

Embedding a PHP script into HTML page

Common Uses of PHP

  • PHP can execute System function that means it can Delete, create, Open, Read, Write from a Systems file.
  • It is possible to delete, rename, create and modify elements from your database only using PHP alone.
  • Using PHP you can restrict the specific user to access the specific page from your Website.
  • PHP can Handle data from your form. Generally, this built-in function used to collect data in information from user like Name, Email, Phone Number or credit card Information
  • And most important things for the web, PHP can encrypt data from the bad user.
  • You can embed PHP for any web application for your functional website

Embed  PHP script in HTML

First of all embedding PHP code into HTML means you can put your code into the tag<html></html> and you can execute the code via a Web Server like Apache or Nginx or any PHP supported Web server. Now we are going to write “Hello world” Script in PHP into a HTML file.  [box type=”info” align=”” class=”” width=””]Inserting a PHP code into HTML file called Embedded PHP[/box]

<html>
   
   <head>
      <title>Hello World</title>
   </head>
   
   <body>
      <?php echo "Hello, World!";?>
   </body>

</html>

If you put this PHP code into your HTML file and if you run this file on a PHP supported Server like Apache or Nginx the following code will give an output “Hellow, World”. Like that, you can insert any kinds of PHP function in order to create a functional website.

 

 

Read also: How to Write PHP Scripts and Run on Local Computer

Leave a Reply

Your email address will not be published. Required fields are marked *