HI, Please suggest me that "How to write PHP session in html page?" My question is "suppose a.htm page when loading at that time it will check session id , If it is found then go to b.htm page neither if not found session id then it will back.". Please suggest me how to do this. It's very urgent for me. Thanks Asit
To use php code you will need to save the page as a .php file instead of .htm Try this code: <?php session_start(); // Start the session if(isset($_SESSION['value'])) { header("Location: http://www.website.com/pagename.htm/"); // Redirect to page if session is found } else { $ref = $_SERVER['HTTP_REFERER']; header( 'refresh: 10; url='.$ref); } ?> PHP:
Hi, I put your code i'm getting this error Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at D:\Inetpub\vhosts\impacterp.com\httpdocs\a.php:2) in D:\Inetpub\vhosts\impacterp.com\httpdocs\a.php on line 3 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\Inetpub\vhosts\impacterp.com\httpdocs\a.php:2) in D:\Inetpub\vhosts\impacterp.com\httpdocs\a.php on line 3 Warning: Cannot modify header information - headers already sent by (output started at D:\Inetpub\vhosts\impacterp.com\httpdocs\a.php:2) in D:\Inetpub\vhosts\impacterp.com\httpdocs\a.php on line 12 Kindly check it.