Jump to content
Killersites Forums

Correct filename extensions


billjup
 Share

Recommended Posts

I'm a newbie so please bear with me. I'm learning how to hand code HTML, CSS, PHP, etc... When creating my files I name them with the appropriate file extension .htm, .css, .php, etc... I've used Notepad and Word to create files. When I try to see the result of my code in a web browser (IE9) it displays the code, not the results of the code. Look at the attachment. Very simple straight-forward PHP. I named the file with .php and it still shows that is is a .txt file. What am I missing? Thanks!

Link to comment
Share on other sites

If you want to see a .html or .htm file displayed in a browser, double click the filename in your file list like Windows Explorer and it should open your default browser, or right-click and "open with" another browser.

 

You cannot see a .php file displayed properly in a browser from a local file unless you have WampServer2 or XAMPP installed as these have Apache server to process the PHP, so check these online or install one of the programs.

 

CSS files when double-clicked should open in Notepad if css files are set to open in Notepad or you can right-click choose program.

 

Don't use Word for coding as some characters like " and ' can carry unwanted hidden code which affects the display.

Link to comment
Share on other sites

Ben's probably right, your files probably have .txt added on the end of the filename that shouldn't be there.

 

When you have been coding in Notepad (or probably most other text editors) and you want to save the file for the first time, use Save As (instead of Save) and type your filename like index.html or contact.php and then make sure Save As Type is All Files (*.*) and not Text Documents (*.txt).

 

Then check that Encoding is ANSI not UTF-8.

 

After the first save, you should be able to click Save instead of Save As after future edits.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...