OK, this is as basic a question as any of you will get on this site. Here's the deal. I have a very basic PHP file saved, of course, as php. I have an HTML page built in Dreamweaver. So, how do I include that file in the HTML so that it is executed? The PHP file is a simple Hello World (I told you this was basic).
<php?
print("Hello World!");
php?>
Pretty simple stuff I know. But I don't know what I have to do or where I have to place this file within the HTML to get it to execute. I'm just getting a blank page. If someone could give me an example of what the HTML looks like with a php file, that would be great. Thanks in advance.
pallen
0
Light Poster
Recommended Answers
Jump to Postphp?> becomes ?>
and
<php? becomes <?php
give that a try
Jump to PostAlso be sure to rename your file from *.html/*.htm to *.php or the PHP code will not execute, it'll display as text.
Jump to Postsorry i didnt mean to confuse things... try this below:
<html> <head> blah blah </head> <body> <?php ALL YOUR PHP CODE GOES HERE ?> </body> </html>
And then just make sure your file has a .php extension!
Jump to Post<html> <head> <title>Blah</title> </head> <body> Blah Blah,<br /> <?php include("helloworld.php"); ?> </body> </html>
helloworld.php is:
<?php echo "Hello World!"; ?>
Anytime you want to run PHP code the file has to end with the extension .php to let PHP know it's a file that …
Jump to PostAre you sure that the hosting provider supports PHP?
All 24 Replies
benhowdle89
0
Junior Poster in Training
pallen
0
Light Poster
dietdew12z
8
Junior Poster
pallen
0
Light Poster
benhowdle89
0
Junior Poster in Training
dietdew12z
8
Junior Poster
pallen
0
Light Poster
pallen
0
Light Poster
pallen
0
Light Poster
steelshark
0
Junior Poster in Training
pallen
0
Light Poster
benhowdle89
0
Junior Poster in Training
benhowdle89
0
Junior Poster in Training
pallen
0
Light Poster
steelshark
0
Junior Poster in Training
hielo
65
Veteran Poster
deathscarz
0
Newbie Poster
baltazar
0
Light Poster
mickey23
0
Newbie Poster
P0lT10n
mickey23
0
Newbie Poster
mickey23
0
Newbie Poster
P0lT10n
Lsmjudoka
0
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.