Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • 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.