通过PHP中的许多页面维护变量的值,没有COOKIES,SESSIONS

I am having problem in maintaing value of variable through several pages(actually through same page but through many refresh).
The first time I get navigated to new page the value of variable is preserved and can be used by echo,but after refreshing the page that value cannot be reused,it shows error that the variable has no value.
I am making a webapp for chatting in php.
I want to show the name of user(sender) on every page(every page of sending message). So I am using code

<?php 
$writtervar = $_POST['writter'];
echo $writtervar;
?> 

I am taking input through a separate page,code is

<form action="ddd.php" method="post">
     Enter your name   <input type="text" name="writter" >
     <input type="submit"  id="submit" value="Press" >
</form>

HTTP is stateless. $_POST array is populated when a user makes a request. If you want to have access to a value accross web views, read on setcookie or sessions.

If you don't want to use cookies, you'll need to resend your parameters on every request (probably obscured some way). Or send an identifier on every request an keep your info server (you can do that with php sessions anyway). But doing that is not convenient nor secure.

You can set a cookie

$value = 'something from somewhere';
setcookie("TestCookie", $value);

and get the value:

echo $_COOKIE["TestCookie"];

You can also use sessions:

session_start();

// Set session variables
$_SESSION["TestSession"] = $value;

// Get session
echo $_SESSION["TestSession"];

You'd better use a framework like Laravel that can help you handle sessions, forms, redirect with values etc.

You can find the documentation on php.net

You can use session. base on your code you can try this: In start page (ddd.php) you have to set your session values.

<?php
  session_start();
  $_SESSION["writer"] = $_POST["writter"];
?>
...

in other page use your session values as e.g:

<?php
  session_start();
  ...
  echo $_SESSION["writer"];
?>

Note that unset and destroy your session at the end off your work.

<?php
    // remove all session variables
    session_unset();

    // destroy the session
    session_destroy(); 
?>