BCAV_WEB Posted November 16, 2010 Share Posted November 16, 2010 Currently I have a Javascript button to close a tab window which is great, but annoying problem is when the user opens up the section again all the previous session errors are there. I have tried the following, which didnt work; [ function destroy() { window.open('destroyCode.php'); } <a href='javascript:window.close()' onclick="destroy()" ><img class='close' src='images/close.jpg' alt='Close Window' /></a> ] [ <?php session_unregister("add_customer_errors"); session_unregister("add_customer_form"); session_destroy(); ?> <html> <body onload="javascript:window.close()"> </body> </html> ] Any ideas of how to do it? I have got the session being unregistered if the data is correct and saved to the database. But what is the user wants to start and then changes there mind. Quote Link to comment Share on other sites More sharing options...
Rifts Posted November 16, 2010 Share Posted November 16, 2010 try making this your destroycode session_start(); session_unset(); session_destroy(); Quote Link to comment Share on other sites More sharing options...
BCAV_WEB Posted November 17, 2010 Author Share Posted November 17, 2010 But that destorys all my sessions, including the one that will keep the user logged in Quote Link to comment Share on other sites More sharing options...
BCAV_WEB Posted November 17, 2010 Author Share Posted November 17, 2010 Sorted it, turns out I had to start the session on that page to close the session's I wanted to close. Thanks for the help [ <?php session_start(); session_unregister("add_customer_errors"); session_unregister("add_customer_form"); ?> <html> <body onload="javascript:window.close()"> </body> </html> ] Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted November 17, 2010 Share Posted November 17, 2010 Do not use session_unregister, instead do <?php session_start(); unset($_SESSION['add_customer_errors']); unset($_SESSION['add_customer_form']); ?> Ken Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted November 17, 2010 Share Posted November 17, 2010 The manual states that session_unregister() is deprecated. Quote Link to comment Share on other sites More sharing options...
BCAV_WEB Posted November 17, 2010 Author Share Posted November 17, 2010 ooppsss... my bad, howcome? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.