Skip to content

Instantly share code, notes, and snippets.

@travisdmathis
Forked from BloodWolf89/gist:5735b7ddc014b7dadaa8
Last active February 24, 2016 20:45
Show Gist options
  • Save travisdmathis/bc797a6abedff388a313 to your computer and use it in GitHub Desktop.
Save travisdmathis/bc797a6abedff388a313 to your computer and use it in GitHub Desktop.
<?php
if($_POST['email'] != '') {
$db = mysqli_connect('localhost', 'cl54-sstats', '******', 'cl54-sstats') OR die('Database Connection Error.');
$email = mysqli_real_escape_string($_POST['email']);
$sql = "INSERT INTO mailing (email) VALUES ('$email')";
if (mysqli_query($sql, $db)) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($db);
}
}
?>
<form action="index.php" method="POST">
<input type="email" placeholder="Your Email Address" name="email" style="font-size:1.7em;font-weight:none;text-align:center;" />
<input type="submit" value="submit" />
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment