为什么php代码在wordpress中执行3次

I am very new to wordpress. I am trying to do the following:

a. I have a very simple html and php based website. I have a signup page which accepts user id and password and then on click of submit button it calls a php file which verifies the userid/password and saves it in the database. THIS WORKS PERFECTLY FINE

b. Now, I trying to move those two pages to wordpress platform. I have installed a php plugin also. Now the problem in wordpress platform is whenever I hit the submit button, in the database 3 duplicate records are getting appended. I have been trying a lot but could not fix this

c. I tried different php plugins but does not work

d. After reading few help documents on the web, I have tried creating my own template page, even that does not work

Any help in this regard will be much appreciated.


EDIT

Form:

<form action="http://xxxxxx.xxx/xxxxxx" method="post">
    Enter User ID:
    <input name="userid" type="text" value="" />Password:
    <input name="password" type="text" value="" />
    Confirm Password:
    <input name="confrimpassword" type="text" value="" />
    <input type="submit" value="SIGN UP" />
</form>

Below is the php file:

<?php
session_start();
?>
<!DOCTYPE html>
<html>
<body>
<?php
// Echo session variables that were set on previous page
//echo "Favorite color is ".$_SESSION["favcolor"].".<br>";
//echo "Favorite animal is ".$_SESSION["favanimal"].".";
?>
<?php
mysql_connect("localhost","***********","**************");
mysql_select_db("******");
$sql1=mysql_query("select * from login_details where customer_id='$_POST[userid]'");

$row=mysql_fetch_assoc($sql1);
if (!$sql1) {
    echo "Could not successfully run query ($sql) from DB: " . mysql_error();
    //exit;
}
else {
    echo " inside last else";
    $sql2=mysql_query("INSERT INTO login_details VALUES ('$_POST[userid]','$_POST[password]')");
    echo "Account successfully Created...";
}
mysql_close();
?>
</body>
</HTML>