title: Server side error message display from process page to index page in php
body: <p>I have to display a server-side validation error message which is working perfectly if I write both codes(HTML and PHP) on a single page.</p>
  
  <p>Now I have index.php and process.php pages. I have to pass server-side validation error message from process.php to index.php. Without using Ajax. would you help me in this?</p>
  
  <p><strong>index.php</strong></p>
  
  <pre><code>&lt;?php
  
  include('../../db/connection.php');
  $fname_error="";
  $email_error="";
  ?&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form action="process.php" method="post"&gt;
          &lt;input type="text" name="fname" value="&lt;?php if(isset($fname)){echo $fname;} ?&gt;"&gt;
           &lt;span class="error"&gt;&lt;?php echo $fname_error;?&gt;&lt;/span&gt;
  
          &lt;input type="email" name="email" value="&lt;?php if(isset($email)){echo $email;}?&gt;"&gt;
          &lt;span class="error"&gt;&lt;?php echo $email_error;?&gt;&lt;/span&gt;
  
          &lt;input type="submit" name="submit"&gt;
      &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>Process.php</strong></p>
  
  <pre><code>&lt;?php
  
  include('../../db/connection.php');
  if (isset($_POST['submit'])) {
  
      $fname=trim($_POST['fname']);
      $email=trim($_POST['email']);
  
      if (empty($fname)) {
          $fname_error="Name is empty";
      }
  
      else
          {
          if ($fname&lt;3) {
          $fname_error="Please enter minimum 3 character";
      }
  }
  
      if (empty($email)) {
          $email_error="Email field is empty";
      }
      else
          {
          if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
            $email_error="Invalid email format"; 
  
      }
      }
  
  
      // insert code here
  }
  ?&gt;
  </code></pre>