i don't know why my php code within the <html> doesn't work at all.

<!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">
<head>
<meta name="xsoldier2006" content="xsoldier2006, 2006, xsoldier, henry li, veteran 2006" />
<link rel="stylesheet" type="text/css" href="css/text.css"/> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Xsoldier_Home</title>
</head>

<body bgcolor="#333333">
	<?php 
	$count = $_COOKIE[ 'visits' ];
    if( $count == "")
    {
    	$count = 1;
    }
    
    else
    {
    	$count++;
    }
    
    setcookie("visits", $count);
	echo "you are visitor number $count";
	?>
</body>
</html>

basically i tried just <?php echo "hi" ?> and it wouldn't work too. it gotta be something missing i guess.

thanks

Recommended Answers

All 3 Replies

did you save the page with a php extension? ex. page.php

yes, i saved it as index.php...this is weird. i just save a text doc with code below index.php

<?php
echo "hi";
?>

and it wouldn't work... i had done more php than this ,, i can't figure it out what happened.

hi,

which web server you are using ?
do you have installed IIS or Apache with PHP?

Rahul

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.