Tuesday 23 August 2011

PHP in HTML | PHP in HTML

TOPIC : PHP in HTML AND HTML in PHP

This is the simple example of inserting PHP in HTML or HTML inside PHP. This is the simple code showing how to insert php code inside an html code. Here is the simple html code and a pic:



###################HTML###########################
<html>
        <head><title>Simple HTML</title></head>
        <body>
                    <h2>Simple HTML</h2>
        </body>
</html>
###################################################


Whenever we want to insert PHP in HTML code we first open php tags( <?php ) and after finishing our PHP code inside HTML, close the php tags ( ?> ). Example of PHP in HTML :

################PHP in HTML######################
<html>
        <head><title>Simple HTML</title></head>
        <body>
                    <h2>Simple HTML</h2>
                    <?php echo 'hello php'; ?>
        </body>
</html>
##################################################

We can also insert HTML in PHP by using php echo statement.The file name should be .php only. For example:

#####################HTML in PHP#################
<?php echo '<h2>HELLO PHP</h2>' ; ?>
##################################################

This was simple tutorial for PHP in HTML.
For more information see php documentation : http://php.about.com/od/learnphp/qt/php_with_html.htm

More Links : DOWNLOAD PHP WALLPAPERS

1 comment: