Jump to content

PHP SESSION on HTML Pages.


m0v0nage

Recommended Posts

 

My website is made up of html files. Recently I realized i needed php. I edited the .htaccess file so that it looks like this:

 

AddType application/x-httpd-php .htm

AddType application/x-httpd-php .html

 

This allowed me to execute php on any html page. But one thing I am having trouble with is accessing Session information. I do this on an html page:

 

$name = $_SESSION['Name'];

 

with the session_start() at the top (I know I did that correctly). It can't seem to find the name. I do the same on a .php page, and it works. But why can't an html page access the Session variables? It can echo things and run other php functions, but why not the SESSION info.

 

I did a little debug test and here is what I got:

 

Notice: Undefined index: Name in /export/home/*****/************.com/public_html/AllWebPages/blog home page.htm

 

the stars are just for my privacy.

 

Apparently it says that there is no SESSION Name. But there is on a PHP page. Why?

 

Link to comment
https://forums.phpfreaks.com/topic/191313-php-session-on-html-pages/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.