Reputation: 121
Is there any other way of sending variables from one page to another without using get
, post
, cookie, or session
?
I'm using header redirect, so I can't use get
or post
and I'm not able to set cookie, so I can't use setcookie
. session is working, but I don't want to use session
for some other reasons.
Is there any other way to send variables?
Upvotes: 1
Views: 1051
Reputation: 5914
You can use session and getmethod to send the value
Get method
header("location:update_profile.php?variable=value")
and get it another page as
<?php echo $_GET['variable']; ?>
Setting session
<?php
session_start();
$_SESSION['variable']='value';
header("location:update_profile.php");
?>
Getting value
<?php
session_start();
$value=$_SESSION['variable'];
?>
Upvotes: 0
Reputation: 158280
i'm using header redirect, so cant use get ...
Of course you can. Use:
header('Location: test.php?foo=bar');
to send the var foo across HTTP redirect as a GET parameter
Also note that a cookie will still be valid after redirect, if:
Upvotes: 2
Reputation: 447
you can use as....
header("location:update_profile.php?msg=record updated")
and get it another page as
<?php echo $_GET['msg']; ?>
or u can use link as
<a href='yoursite.php?user=anything......'>click</a>
and retrieve it via Get[]
Upvotes: 0
Reputation: 338
maybe this below HTML5 feature will help you, I mean: sessionStorage
http://www.w3schools.com/html/html5_webstorage.asp
Tell me if it's what you were looking for.
Upvotes: 0