i have this code that receive form input example below code my problem is how do i put this output into session so even when i refress or reopen this page i we still have my output code:
session_start();
if (isset($_POST["chedit"]))
{
$text = $_POST["text"];
$mumu = $_POST["edit"];
$_SESSION["text"] = $text;
$_SESSION["mumu"] = $mumu;
$text = $_SESSION["text"];
$mumu = $_SESSION["mumu"];
echo $text;
echo $mumu;
}
every thing is working fine but if i try to reopen this page i got my recent output lost can any fixed this? Big thanks
This way $_POST['text]
and $_POST['edit']
will be stored in $_SESSION['text']
and $_SESSION['mumu']
and always printed:
<?php
session_start();
if (isset($_POST["chedit"]))
{
$text = $_POST["text"];
$mumu = $_POST["edit"];
$_SESSION["text"] = $text;
$_SESSION["mumu"] = $mumu;
}
if (isset($_SESSION["text"]) && isset($_SESSION["mumu"]))
{
echo '<p>' . $_SESSION["text"];
echo '<p>' . $_SESSION["mumu"];
}
?>
But of course you can use that variables however you want. They will be stored as long as you don't close the navigator.