Simple HTML embedded application in PHP


Introduction

PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.

General declaration of PHP

A PHP scripting block always starts with <?php and ends with ?>. A PHP scripting block can be placed anywhere in the document.

<?php
?>
 
On servers with shorthand, you can start scripting like "<?  and  ?>".

Variable declaration

  • Variables are used for storing values, like text strings, numbers .
  • When a variable is declared, it can be used over and over again in your script.
  • Symbol : $ sign
  • Syntax  : $var_name = value;
    e.g.   <?php
             $txt="DEEPAK DWIJ ";
             ?>

HTML page scripting

Save this page by name d.html, in this page user input the name and age.

f1.gif

PHP program

This is a php program named d.php, is calling by HTML page

f2.gif
To run the Program with XAMPP Server

Step 1 :
Save both HTML & php file inside deepak folder.

Step 2 : Open browser -write http://localhost/deepak/filename.html

Output

After writing http://localhost/deepak/filename.html on browser the webpage looks like

f3.gif

After clicking on submit Query button

f4.gif
 

Up Next
    Ebook Download
    View all
    Learn
    View all