keep the values of a inputbox after i went to a error page
===

Hello i was wondering if its possible to keep the values that already were typed in correctly in a form by using cookie/sessions.. the way i tought to do this was like this but i don;t know what to do after this. ( i know that i have to echo the values of these sessions in the value part of the inputbox but how? )

and i am also not sure if my code is written correct. i really appreciate it if someone could explain me the clue.. thanks in advance! ( below u see the code i have used for this )

    $mailErrors = array();

      if($_SERVER['REQUEST_METHOD'] == 'POST')
      {

          if(!isset($_POST['name']) || trim($_POST['name']) == '')
          {
            $mailErrors[] = 'vul uw naam in s.v.p';
          }

          else
          {
            $enaam = $_SESSION['name'];
          }

          if(!isset($_POST['email']) || trim($_POST['email']) == '')
          {
            $mailErrors[] = 'vul een email in s.v.p';
          }

          else
          {
            $eemail = $_SESSION['email'];
          }

          if(!isset($_POST['message']) || trim($_POST['message']) == '')
          {
            $mailErrors[] = 'vul een bericht in s.v.p';
          }

          else
          {
            $eebericht = $_SESSION['message'];
          }

          $mailerr = '';
          if( count($mailErrors) > 0 )
             {
                $err = '';
                $err .= '<section class="main"><br>';
                foreach ($mailErrors as $error) {
                  $err .=  $error . '<br>';
                }
                $err .= '<a href="index.php" class="read-more">opnieuw</a>';
                $err .= '</section>';

                echo $err;
             }
          
          else
          {
            $website_naam = '***.nl';
            // Jouw eigen geldige emailadres
            $eigen_emailadres = 'info@***.nl';
            // Een geldig emailadres voor errors
            $error_emailadres = 'reshadfar@gmail.com';
            // De naam van de verzender
            $naam_verzender = 'afzender';
            // Het geldige emailadres van de afzender
            $email_verzender = $_POST['email'];
            // Een geldig emailadres of helemaal leeg laten
            $bcc_emailadres = '';
            // HTML mail? True/False
            $html = true;

            $to      = '***@gmail.com';
            $subject = 'contactform ***.nl';
            $message = 'Bericht: ' . $_POST['message'] . "\r\n";
            $headers   = 'From: ' . $website_naam . ' <' . $eigen_emailadres . '>' . PHP_EOL;
            $headers  .= 'Reply-To: ' . $naam_verzender . ' <' . $email_verzender . '>' . PHP_EOL;
            $headers  .= 'Return-Path: Mail-Error <' . $error_emailadres . '>' . PHP_EOL;
            $headers  .= ($bcc_emailadres != '') ? 'Bcc: ' . $bcc_emailadres . PHP_EOL : '';
            $headers  .= 'X-Mailer: PHP/' . phpversion() . PHP_EOL;
            $headers  .= 'X-Priority: Normal' . PHP_EOL;
            $headers  .= ($html) ? 'MIME-Version: 1.0' . PHP_EOL : '';
            $headers  .= ($html) ? 'Content-type: text/html; charset=iso-8859-1' . PHP_EOL : '';

            mail($to, $subject, $message, $headers);

            $succeed = '';
            $succeed .= '<section class="main">';
            $succeed .= 'mail succesvol verstuurd';
            $succeed .= '<a href="index.php" class="read-more">Ga verder</a>';
            $succeed .= '</section>';

            echo $succeed;
          }
      }
      else
      { 
             ?>
                    <section class="main">
                  <form action="" method="post"> 
                    
                    <fieldset id="user-details">  
                      
                      <label for="name">Naam:</label>
                      <input type="text" name="name" value="" placeholder="Vul uw naam in" > 
                    
                      <label for="email">Email:</label> 
                      <input type="email" name="email" value=""  placeholder="Vul uw email adress in"/> 
                    
                    </fieldset>
                    
                    <fieldset id="user-message">
                    
                      <label for="message">Uw bericht:</label> 
                      <textarea name="message" rows="0" cols="0" placeholder="Vul hier uw bericht in"></textarea> 
                    
                      <input type="submit" value="Verzenden" name="submit" class="submit" />   
                    
                    </fieldset>
                     
                  </form>
                </section>     
              <?php
      }
