Submit form post to login
<p>I have the following HTML file where the user will enter their username and password and click on the submit button. </p>

<pre><code>&lt;form Name ="form1" Method ="POST" ACTION = "userlogin.php" id="form1"&gt;
    &lt;div id="main_body" class="full-width"&gt;
        &lt;label&gt;Username:&lt;/label&gt;
        &lt;input type = "text"
               id = "usernameLogin"
               name="pat_username"&gt;
        &lt;label&gt;Password:&lt;/label&gt;
        &lt;input type = "password"
               id = "passwordLogin"
               name="pat_password"&gt;
        &lt;input type="submit" onclick="click_button_login()" value="Login" name="submit" id="submit"/&gt;
    &lt;/div&gt;
&lt;/form&gt;
</code></pre>

<p>The PHP file should they connect to my database and check whether the users details entered are corrent. The database connection is there as I have tested this before. Once the user clicks on the submit button this error appears:  <code>Cannot POST /http-services/emulator-webserver/ripple/userapp/x/C/xampp/htdocs/xampp/glove_project_php/www/userlogin.php</code></p>

<pre><code>&lt;?php
if(isset($_POST["submit"])){
    $servername = "localhost";
    $username = "root";
    $password = "";
    $dbname = "dbname";

    // Create connection
    $conn = new mysqli($servername, $username, $password, $dbname);

    //Check connection
    if ($conn-&gt;connect_error) {
        die("Connection failed: " . $conn-&gt;connect_error);
    }


    $newUsername = mysqli_real_escape_string($conn, $_POST['pat_username']); 
    $newPassword = mysqli_real_escape_string($conn, $_POST['pat_password']);   

    $result = $conn-&gt;query("SELECT * FROM tablename WHERE patient_username ='$newUsername' AND patient_password='$newPassword'");



    if (mysqli_num_rows($result)) {
        header("Location: mainmenu.html");       
    } 
    else
    {    
        header("Location: index.html");

    }
    $conn-&gt;close();
}
?&gt;
</code></pre>

<p>Is there a different way of calling this PHP file to work on an emulator? This code works perfectly on localhost. </p>