m0v0nage Posted February 8, 2010 Share Posted February 8, 2010 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 More sharing options...
teamatomic Posted February 8, 2010 Share Posted February 8, 2010 Ant time you want to access session vars you must start a session, every time, every page. HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/191313-php-session-on-html-pages/#findComment-1008668 Share on other sites More sharing options...
m0v0nage Posted February 8, 2010 Author Share Posted February 8, 2010 I do but it can't get session variables. Link to comment https://forums.phpfreaks.com/topic/191313-php-session-on-html-pages/#findComment-1008677 Share on other sites More sharing options...
Mchl Posted February 8, 2010 Share Posted February 8, 2010 Also make sure you use same session_name averywhere Link to comment https://forums.phpfreaks.com/topic/191313-php-session-on-html-pages/#findComment-1008697 Share on other sites More sharing options...
PFMaBiSmAd Posted February 8, 2010 Share Posted February 8, 2010 You already have an existing thread for this problem - http://www.phpfreaks.com/forums/index.php/topic,286765.msg1359675.html#msg1359675 Did you bother to do what I suggested for debugging the problem in that thread? Link to comment https://forums.phpfreaks.com/topic/191313-php-session-on-html-pages/#findComment-1008748 Share on other sites More sharing options...
m0v0nage Posted February 8, 2010 Author Share Posted February 8, 2010 Yes I did. I put it in my new post. Link to comment https://forums.phpfreaks.com/topic/191313-php-session-on-html-pages/#findComment-1008843 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.