Can you display a success message after redirect without using a session?
Is it possible to show success message o开发者_开发百科n another page without using $_SESSION
?
Example
process.php
header('location:/thank-you.php');
$success = 'Thank you. Please come again';
exit();
thank-you.php
if(isset($success)) { echo $success; }
Currently it's not working. Let me know how it can be done.
You could do this:
process.php
header('location: /thank-you.php?mess=1');
exit();
thank-you.php
$mess = isset($_REQUEST['mess']) ? $_REQUEST['mess'] : null;
if($mess == 1) {
echo 'Thank you. Please come again'; }
This is not optimal but should work for simple scenarios.
header('location:/thank-you.php?success=Thank+You+Please+Come+again');
and
$success =$_GET['success'];
if(isset($success)) { echo $success; }
精彩评论