Friday, March 27, 2015

How to Write PHP code in html page

Hi Guys, Today i am going to explain you how to write or embed php code in html code.First i would like to take an brief intoduction about what is meant by php ?

What is meant by PHP:

PHP means Hypertext PreProcessor. PHP is a server side programming language.Server side programming language means it executes at server end. Be practical suppose for example if you are accessing one webpage from your webbrowser. First it sends request to the server once the server responds to your webbrowser request then it sends some data to browser to display it to you.Some times browser will directly displays the data without requesting to server these type of programming languages called as client side programming languages.Server Side programming languages executes at server end only.So PHP is also a one the famous and popular,dynamic server side programming language.

Facebook is also coded in php language.


How to Write PHP code in html page
How to Write PHP code in html page

How to embed php code in html,css code:

Suppose you are developing a webpage in html you need php support to add some functionalities to your web application.

<html>
<body>
</body>
</html>

how to embed php code in the above html code?
Answer is very simple.

<html>
<body>
<?php
echo "Here you can write your PHP code"
?>
</body>
</html>

Now explanation of the above code.PHP starts with "<?php" or "<?". Wherever these statements are encounterd by server it recognizes this is the starting of the php code."Echo" means its a one php statement it states that print statement. its similar tp print statement in C language.And finally "?>" states that ending of the php code.

Output:
Here you can write your PHP code

Stay tuned to learn more about PHP Programming...:) <3 <3 <3