I am trying to make a submit button that the user clicks after entering an email address. The email address should then be sent to a database. I am not sure why this is not working.
A database connection is established and tested beforehand. The file has a php extension. No error messages were received, but no data is uploaded to the database.
<form action='' method="post">
<label>Email Address</label>
<input type="text" name = "emailaddress" />
<?php
if ($_POST["emailaddress"] != "" && $_POST["emailaddress"] != null) {
$youremail = $_POST["emailaddress"];
mysql_query("INSERT INTO email_table (emailAddress) VALUES ('".$youremail."')");
Print"Your information has been successfully added to the database.";
}
?>
<input type="submit" value="Add Email">
</form>