Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax Help Please 1

Status
Not open for further replies.

FireGeek21

Technical User
Dec 12, 2007
218
US
I am new to PHP and have been going through some tutorials. It seems fairly easy to learn. Immediately, I am having issues with what is displayed on the web. This is what is displayed:

Current date and time: " . date("r") . "
"; ?>

Here is my simple code I am using out of a tutorial. Is this a case of a bad tutorial or is there some syntax issue I need to tweak?

Code:
<html>
<head>
<title>My first PHP document</title>
</head>
<body>

<?php 

echo "<p>Current date and time: " . date("r") . "</p>";

?>

</body>
</html>

THANK YOU!!!

FireGeek
(currently using Crystal Reports XI with Lawson 9.01)
 
i suspect that this request is not being parsed by php. either because you have incorrectly configured php or you have not named the file correctly.
 
Hi

... or everything is configured and named correctly, but the OP opened the file in the browser, instead of requesting it. ( Simply put : the protocol in the location bar is http:// or file:// ? )

Feherke.
[link feherke.github.com/][/url]
 
@feherke
wouldn't then he also have seen the html tags?
 
@feherke

slow witted today. you are quite right.
 
Thank you for all your help. I was going thru tutorials and trying to learn this on my own. As it turns out, none of the tutorials I was going through said I should name the file with the .php extension. Because of the <html> tags, I assumed it should be saved with the .html extension.

Assume no more! If it has <?php code/tags, save it as a .php file.

Thanks again! More questions yet to come I am sure!

FireGeek
(currently using Crystal Reports XI with Lawson 9.01)
 
If it has <?php code/tags, save it as a .php file.

there are alternatives, but that's the standard and most used method.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top