on air

Embedding PHP Into HTML & Return.

back home » Scripting Tutorials » PHP » Embedding PHP Into HTML & Return.


Turning HTML Into PHP.

HTML is a static website creation language called "Hyper Text Markup Language".

And PHP is a dynamic scripting language use on a server side to create websites and more.

You can easily turn an HTML document into a PHP document. You'll simply have to save the HTML file with an extension .php instead of .html or .htm.

The Benefit Of Using PHP Extension Instead Of HTML.

Using the extension .php will not negatively impact your HTML document. However, it will strengthen its capabilities.

Your document will still be the same when loaded in a browser. The good thing is, you'll be able to include PHP scripts, likewise, HTML elements into it at any time.

Embedding HTML Into PHP Document.

After saving your document with the extension .php, you'll have two ways of embedding HTML into the PHP document.

Option One: [PHP Wrapped Inside HTML Tags].

In this option, the PHP script is completely wrapped inside the HTML body tags. The body tags can also contain some more HTML elements. As long as they stay outside of the PHP syntax:

See Illustration below.

<html>
<title>Embedding PHP inside HTML</title>
<body>
<h1>Option 1</h1>
<?php
  //your php code will be placed here. Make sure you close it like so.
?>

<p>After closing PHP, you can add your HTML here, 
close tags, and another PHP script can follow.
</p>

<?php
  //Your next php script may follow...
?>
</body>
</html>

Option Two: [HTML Wrapped Inside PHP Syntax].

In this option, the HTML is placed inside of the PHP syntax. Using this method you can either use the "Print" or "Echo" statement, or both. [using it separately is preferred].

This is a useful method, usually when writing a short code. Seeing here, the same code structure can contain both the "Echo and Print" statements. However, what you must be aware of is that, their outputs are always placed inside quotations. ["xxx"]

See Illustration below.

<?php
echo "<html>";
echo "<title>HTML with PHP</title>";
echo "<b>Option Two</b>";
//your php code will be placed here.
Print "<i>\"Print\" could also be comprised in the same structure.</i>";
?>

Quick Tips.

Including quotation marks as part of your statement. You must always place a backslash before it.

See the illustration below.

<?php 
print "Say it loud \"I'm black and proud\"" 
?>

Also every line of a statement inside your PHP syntax must end with a semicolon. [;]

You may leave out the semicolon if you have only a line script like in the illustrator above.

Video Embedding PHP Into HTML.

You must not be a savvy to understand this tutorial. Just be cool and concentrative, you'll grasp it. Good Luck.

Clicks4UrMind

Man will give you worldly powers, and make you feel on top of all, note this is temporally and could be redrawn at anytime sending you back to the ground floor of life. However, the Lord Almighty, the one and the only rightful ruler of the Universe, blesses everlastingly.

Brain

Knowledge is Power, but Power is not Knowledge. Wisdom is the truthful Power that identifies the Knowledge within the man. And only, I repeat 3x. Only the almighty God has the power to bless the man with his Wisdom forever.

To achieve the Lord's blessings, cease not praying daily, asking for his Wisdom, and you'll be blessed abundantly...

SPYERA PHONE

Spyera Phone

Spyera Phone version is software that you install on a smart phone to monitor everything happening on the phone. After installation, SPYERA secretly records events (sms, call history, phone book, location, emails, What's App messages, IM, Facebook Chat, Skype, See photos taken and many more...) that happen on the phone and delivers these information to a web account, where you can view these reports 24/7 from any Internet enabled computer or mobile phone. SPYERA also allows you to listen to the surroundings of the target mobile , listen to the phone conversation and to know the location of the device.

 

Please, Kindly Donate What You Can, Enabling Us Pay Hosting And Domain Costing, And Do More.

Please Donate