Help - Search - Members - Calendar
Full Version: PHP Code in HTML page
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
Wolume
Hello.

I want add PHP code in HTML page, but I'm getting an error. sad.gif

This is my HTML page:
CODE
<html>
<head></head>
<body>
    
[i]PHP code must be here[/i]

</body>
</html>


I want to where it reads "PHP code must be here" this is the code:
CODE

error_reporting(0);
$IP = array("  " => "11.11.111.11:11111",);
while(list($ServerName,$Host)=each($IP)) {
list($IPAddress,$Port)=explode(":",$Host);
echo("".$ServerName);
if($fp=fsockopen($IPAddress,$Port,$ERROR_NO,$ERROR_STR,(float)0.5)) {
echo("<iframe src='http://11.11.111.11/x.php' name='I1' width='185' height='380' frameborder='0' id='I3'></iframe>");
fclose($fp);
}
else {
echo ("IP: <b>11.11.111.11</b><br>Port: <b>11111</b><br>Status: <font color='red'><b>Offline</b></font>");
}
}



I tried to write the <?php CODE ?>, but still bad... So I ask for your help.


Sorry for my bad language blush.gif
Frederiek
QUOTE
I tried to write the <?php CODE ?>, but still bad...

That's good. But your HTML page needs to have a .php extension, not .html or .htm.
If you thn still get errors, they'll be related to the PHP script itself.
Christian J
Which error are you getting?

QUOTE(Frederiek @ May 30 2009, 01:08 PM) *

your HTML page needs to have a .php extension, not .html or .htm.

Most web hosts that offer PHP let you run it with .html/.htm extensions as well if you use a .htaccess directive like

CODE
AddHandler application/x-httpd-php .phtml .php .html .htm
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.