Simple Newsletter Email Submit Code

Hi there

I am looking for a very simple email submission code, where there is a box and the user can enter their email and press submit, then the page reloads and there is a message it was successfully submitted or something.

The email address could be stored in MySQL or to a file.

The key is simple. Or if you know of a script available that would work too.

Many Thanks!

  id int(11) NOT NULL auto_increment,
  email varchar(255) NOT NULL default '',

  $link = mysql_connect('localhost', 'mysql_user', 'mysql_password') or die('Not connected : ' . mysql_error());
  mysql_select_db('foo', $link) or die ('Can\\'t use foo : ' . mysql_error());
  mysql_query("INSERT INTO emails (email)VALUES('".mysql_real_escape_string($_POST['email'])."')");
  echo "Your email has been submitted successfully.";
    <form action="{$_SERVER['PHP_SELF']}" method="post">
      Email: <input type="text" name="email" /> <input type="submit" value="Submit" />

Thank you very much! I am trying to install it by inserting the code directly into a Wordpress sidebar template, but I get the following error:

<b>Parse error</b>:  syntax error, unexpected '{' in <b>/home/inreview/public_html/wp-content/themes/see-you-at-the-beach/sidebar.php</b> on line <b>16</b><br />

I have created the table and the user etc.

The error means that you have wrongly placed a ‘{’ braces bracket somewhere in your code. I believe that php_daemon’s code is perfectly fine, check your code again to see if all the braces brackets correspond to each other.