Member Avatar for mansimran88

The message is not showing. Please help me. Thanks

<?php
/* logout.php */

require('obj.php');


session_destroy();
	

	$_SESSION['msg']='You have successfully logged out. Thank you for the visit.';
			
		header('Location: '.$kPathUrl->adminUrl.'/login.php');
			exit;
			

?>

Recommended Answers

All 3 Replies

The message is not showing. Please help me. Thanks

Your session already destroyed, then the $_SESSION will not work. try to use javascript to alert message and redirect it to another page, cause you will not echo anything before header();

Do this >>

<?php
session_start();

require('obj.php');

session_destroy();
	

echo '
<script type="text/javascript">
alert("You have successfully logged out. Thank you for the visit.");
window.location = "your_url_here";
</script>    
';

exit();			

?>

hope this help you >>

Member Avatar for mansimran88

Finally, its working...thank you so much..:)

Finally, its working...thank you so much..:)

Please mark it solved, if you solved your question,,,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.