PHP Log in System will not echo error statement
<p>Hi i have just created a login system using php and mysql the login system works when entering a vaild username and password from the database but when i enter an invalid username and password it just loops back to the login page even though i have statment saying it fails that i want printed if the login fails here is my code file  </p>

<pre><code>&lt;?php
require_once("Connections/connection.php");
error_reporting(E_ALL ^ E_NOTICE); 

$userid =   $_POST['userid'];
$password =  $_POST['password'];
$submitted =  $_POST['submitted'];
if ($userid &amp;&amp; $password){
    $query  =sprintf("SELECT * FROM users where user_name= '$userid' and user_password = '$password'");
    $result =@mysql_query($query);
    $rowAccount =@mysql_fetch_array($result);
}
if ($rowAccount){
    echo "The record exists so you can enter ";

} elseif($submitted){
    print "you don't exist in the system!";
}


?&gt;
</code></pre>

<p>My HTML:</p>

<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" name="form1" method="post" action="&lt;?php $_SERVER['PHP_SELF'];?&gt;"&gt; 
  &lt;table width="800"&gt;
    &lt;tr&gt;
      &lt;th width="233" scope="col"&gt;User ID &lt;/th&gt;
      &lt;th width="555" scope="col"&gt;&lt;p&gt;
        &lt;label for="userid"&gt;&lt;/label&gt;
        &lt;label for="userid"&gt;&lt;/label&gt;
        &lt;input type="text" name="userid" id="userid" /&gt;
      &lt;/p&gt;
      &lt;p&gt;&amp;nbsp; &lt;/p&gt;&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Password &lt;/td&gt;
      &lt;td&gt; &lt;label for="userid"&gt;&lt;/label&gt;       &lt;label for="password"&gt;&lt;/label&gt;

      &lt;input type="text" name="password" id="password" /&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&amp;nbsp;&lt;/td&gt;
      &lt;td&gt;   &lt;input type="hidden" name="submitted" id="submitted" /&gt;        &lt;input type="submit" name="Submit" id="Submit" value="Submit" /&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>to get the echo working  had to add a value to the hidden field and it worked
   </p>
