I have some PHP and HTML code which should send data from the form to my MySQL database. However, on clicking Submit in the form, the page reloads and nothing happens. No echo or anything. The HTML is in the same file as the PHP file.
$sql = "INSERT INTO accounts (username, password)
VALUES (‘$usernamep’, ‘$passwordp’)";
// use exec() because no results are returned
echo $sql . "
" . $e->getMessage();
$conn = null;
Note: I know this code is currently subject to SQL injection, and the password is not encrypted. It is temporary starting code in an attempt to get it working first.
You lack the name attribute in the submit button, add name="submit".