title: How to display error message in view page using PHP
body: <p>I need to display the error message  using php.I am explaining my code below.</p>
  
  <blockquote>
    <p>addcomplain.php:</p>
  </blockquote>
  
  <pre><code>&lt;div style="color:#F00; text-align:center;"&gt;&lt;?php echo $error?&gt;&lt;/div&gt;
  &lt;form name="billdata" id="billdata"  enctype="multipart/form-data" method="POST" onSubmit="javascript:return checkForm();" action="complain.php"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Suppose i have a form like above and when i submit the below file is called.</p>
  
  <blockquote>
    <p>complain.php:</p>
  </blockquote>
  
  <pre><code>$sql="SELECT * FROM medilink_complain WHERE email='".$email."'";
  $selres = mysqli_query($con,$sql);
   if(mysqli_num_rows($selres ) &gt; 0)
     {
      $error = "Email Id already exists!";
  
      }
  </code></pre>
  
  <p>when the above error will come,i need it should display just above the form.In my case i am not getting anything.Please help me to resolve this issue.</p>