View Single Post
Old 01-13-2005, 05:26 PM  
calmlikeabomb
Confirmed User
 
calmlikeabomb's Avatar
 
Join Date: May 2004
Location: SW Palm Bay, Florida
Posts: 1,323
If you use sql and php....

Code:
<!-- Begin newsletter form  -->
<form name="newsletter" action="newsletter.php" method=hahahahahaha>
<input type="text" name="email" class="newsletter" style="width:140px" maxlength="70" />
<input type="image" class="newsletter" src="images/subscribe.gif" alt="Subscribe" name="submit" />
<!-- End newsletter form -->

<?php
// Register the user in the database.
	require_once ('mysql_connect.php'); // Connect to the db.
		
	// Create a function for escaping the data.
	function escape_data ($data) {
		global $dbc; // Need the connection.
		if (ini_get('magic_quotes_gpc')) {
			$data = stripslashes($data);
		}
		return mysql_real_escape_string($data, $dbc);
	} // End of function.

	$message = NULL; // Create an empty new variable.
	
	// Check for a email address.
	if (empty($_POST['email'])) {
		$e = FALSE;
		$message .= '<p>You forgot to enter your email!</p>';
	} else {
		$e = escape_data($_POST['email']);
	}
	
	
	if ($e) { // If everything's OK.

			$query = "INSERT INTO newsletter set email='$e'";		
			$result = @mysql_query ($query); // Run the query.
			if ($result) { // If it ran OK.
			
// Send an email
				$body = "Thank you for subscribing to our Penis Enlargement Product newsletter!\n\n
						 Our newsletter will be in your inbox waiting for you every Monday morning.
						 Sincerly,\n
						 Levi Lewis\n
						 www.penis-enlargement-product.us";
				mail (($_POST['email']), 'Thank you for registering!', $body,'From: [email protected]');
				echo '<p>You have been registered!<br> Details of this registration have been sent to your email address.</p>';
								
			} else { // If it did not run OK.
				$message = '<p>You could not be registered due to a system error. We apologize for any inconvenience.</p><p>' . mysql_error() . '</p>'; 
			}		
		} 
		mysql_close(); // Close the database connection.


// Print the error message if there is one.
if (isset($message)) {
	echo '<font color="red">', $message, '</font>';
}
?>

</form>
__________________
subarus.
calmlikeabomb is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote