State Management In PHP
State Manage:means tracking user state(location path) where user migrated.
Two Types of state: previous and forward state
How Many Ways we can Handle State
1. using url
2. session
3. File Handling
Using Url:
we maintain the state or current url of user using Query String state should be maintain from the page itself
action="valid-upload.php?/=<?php echo basename($_SERVER['PHP_SELF']);?>
or
<a href="target.php?/=<?php echo basename($_SERVER['PHP_SELF'])?>">
Make a Key in url and note down the Current Page name or its url
header("location:{$_REQUEST['/']}");
then you can header(location) using keyname /
for example
header("location:{$_REQUEST['/']}")
0 Comments