user2986042 user2986042 - 29 days ago 4x
HTML Question

How can i maintain a session for a HTML page in Apache server?

I am new in session management for website. I created a simple Form page with all the data. After clicking submit button, my forms input fields will disable. And the submit button changes to disconnect. This is working fine with Apache server.

Now i want a solution that when I refresh this page or load a same page in new tab, I need to show the same disabled for page. Means, do not refresh the page. I need to maintain this page when user press disconnect button. Should I use database with login details?

Any suggestions? or tutorials links?


sessions are not managed by html files. You'll need to create php files like this:

session_start(); // without this, you won't have any session
// add here code to manage your session/post data
    $_SESSSION['title'] = strip_tags($_POST['title']);
<form action="" method="post">
<input type="text" name="title" value="<?php echo $_SESSION['title']; ?>" />
<input type="submit" value="Save" />

In above example the submit will be made in the same page.


Don't use this in production. This example is for demonstration purpose only.