PHP MySQL not submitting or working

Home / Uncategorized / PHP MySQL not submitting or working

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 "Success";
catch(PDOException $e)
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".

Read more

Leave a Reply

Your email address will not be published. Required fields are marked *