Mind blowing SEO improving and Google rank increasing Signature Rotator SEO Tool.

How to add HTML to PHP or PHP to HTML?

make money online
gamer Offline referral

Posts: 193
Joined: May 2013
Reputation: 4

Hello, could anybody explain how do I add some HTML code to my PHP or maybe it should be PHP code added to HTML code? I mean I have no idea, also will the file extension be .php or .html ?

One more thing lets say I have index.html file in my directory to prevent people from seeing the content of it but will index.php do the same thing or it has to be .html not .php file?
invisibe_dude Offline referral

Posts: 825
Joined: May 2013
Reputation: 24

Posting Freak
if you add PHP to HTML code then the file extension will have to be .php otherwise PHP code will not work! But you can create a plugin that will interpret PHP in HTML if you really need .html extension!

To add PHP inside HTML just add this code wherever you want PHP code to show!

PHP Code:
// PHP code goes here

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Web Page Title</title>
echo '<div style="color: red; font-size: 22px;">I am php code and this is how you add PHP to HTML</div>';

Save it as index.php and upload it to your testing directory!
fashionsappeal Offline referral

Posts: 13
Joined: Apr 2014
Reputation: 0

Junior Member
1. Add HTML into PHP :


----PHP code gose here---


<--- HTML code gose here---->

----PHP code gose here---


2. Add PHP into HTML :

<div>"Any HTML tag"
<?php Code ?>

Google this topic

User(s) browsing this thread: 1 Guest(s)