Embedding PHP code/file in HTML file
Moderator: General Moderators
-
dagadakrishna
- Forum Commoner
- Posts: 29
- Joined: Fri Jan 19, 2007 3:30 am
Embedding PHP code/file in HTML file
hi can anyone help me how to embedd PHP file/code in HTML file
suppose i have HTML file Like this
<html>
<head></head>
<body>
WELCOME
</body>
</html>
here suppose if i want to put PHP code how to do.
I have written like this in my "Welcome.html"
<html>
<head></head>
<body>
WELCOME
<h1>
<?php echo "I LOVE PHP!"; ?>
</h1>
</body>
</html>
But its not working.
is it the correct way of writing
And another one is if i want to include PHP file in my HTML file means whats the procedure, can any one suggest me
Byeeeeeeee
suppose i have HTML file Like this
<html>
<head></head>
<body>
WELCOME
</body>
</html>
here suppose if i want to put PHP code how to do.
I have written like this in my "Welcome.html"
<html>
<head></head>
<body>
WELCOME
<h1>
<?php echo "I LOVE PHP!"; ?>
</h1>
</body>
</html>
But its not working.
is it the correct way of writing
And another one is if i want to include PHP file in my HTML file means whats the procedure, can any one suggest me
Byeeeeeeee
Code: Select all
<html>
<head></head>
<body>
WELCOME
<h1>
<?php echo "I LOVE PHP!"; ?>
</h1>
</body>
</html>Your code is ok.
-
dagadakrishna
- Forum Commoner
- Posts: 29
- Joined: Fri Jan 19, 2007 3:30 am
It has to be *.php as this tells the server what the file contains and makes the server parse it.
A *.php file can contain only html if you wish.
Make sure you have a server running on your testing machine too, or you want get proper output.
(you could configure your server to parse *.html too, but I strongly sugest you don't).
A *.php file can contain only html if you wish.
Make sure you have a server running on your testing machine too, or you want get proper output.
(you could configure your server to parse *.html too, but I strongly sugest you don't).
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
If you are at all set on using html files however, you would put your php code into separate *.php files and then include them into your html
Code: Select all
<!--#include file="*.php"-->-
dagadakrishna
- Forum Commoner
- Posts: 29
- Joined: Fri Jan 19, 2007 3:30 am
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
-
dagadakrishna
- Forum Commoner
- Posts: 29
- Joined: Fri Jan 19, 2007 3:30 am
-
dagadakrishna
- Forum Commoner
- Posts: 29
- Joined: Fri Jan 19, 2007 3:30 am
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
LAST WARNING before punishment is handed out dagadakrishna.
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:11. Please use proper, complete spelling when posting in the forums. AOL Speak, leet speak and other abbreviated wording can confuse those that are trying to help you (or those that you are trying to help). Please keep in mind that there are many people from many countries that use our forums to read, post and learn. They do not always speak English as well as some of us, nor do they know these aberrant abbreviations. Therefore, use as few abbreviations as possible, especially when using such simple words.
Some examples of what not to do are ne1, any1 (anyone); u (you); ur (your or you're); 2 (to too); prolly (probably); afaik (as far as I know); etc.