simple PHP signup form wont POST to MySQL Database : <p>I'm very new to this, I made a php to test the connection with the database and it seems fine, but writing information to a table isn't working.</p>

<p>Heres the index.php (where the signup form is)</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta charset="UTF-8"&gt;
&lt;title&gt;Title of the document&lt;/title&gt;
&lt;link rel="stylesheet" type="text/css" href="style.css"&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;form action="signup.php" method="POST"&gt;
	&lt;input type="text" name="firstname" placeholder="Firstname"&gt;&lt;br&gt;
	&lt;input type="text" name="lastname" placeholder="Lastname"&gt;&lt;br&gt;
	&lt;input type="text" name="uid" placeholder="Username"&gt;&lt;br&gt;
	&lt;input type="text" name="pwd" placeholder="Password"&gt;&lt;br&gt;
	&lt;input type="submit"&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre>
</div>
</div>
</p>

<p>Heres the signup.php (which is what i think might be broken)</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php

include 'dbh.php';

$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$uid = $_POST['uid'];
$pwd = $_POST['pwd'];

$sql = "INSERT INTO useraccounts (firstname, lastname, uid, pwd) 
VALUES ('$firstname', '$lastname', '$uid', '$pwd')";
$result = mysqli_query($conn, $sql);

header("Location: index.php");

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

<p>and heres the dbh.php which connects to mysql</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php

$conn = mysql_connect("hostname", "username", "password", "databasename");


if (!$conn) {
	die("Connection failed: ".mysql_connect_error());
}

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

<p>I'm sure there's already a load of questions like mine out there but I'm so new to this I'm finding it hard to learn from the answers I've come across</p>
