jstratos Posted February 11, 2009 Share Posted February 11, 2009 I have a simple SIGN-UP form which sends information to the mysql database TABLE named "UPDATES". I want to generate a form that will allow me to type in a message and then send it to ALL the email addresses stored in the TABLE "UPDATES" Here's my PHP: <?php include 'config.php' ?> <?php include 'opendb.php' ?> <?php // Form1 starts here $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO updates (name, email, address, city, state, zip, phone, comments) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['name'], "text"), GetSQLValueString($_POST['email'], "text"), GetSQLValueString($_POST['address'], "text"), GetSQLValueString($_POST['city'], "text"), GetSQLValueString($_POST['state'], "text"), GetSQLValueString($_POST['zip'], "text"), GetSQLValueString($_POST['phone'], "text"), GetSQLValueString($_POST['comments'], "text")); mysql_select_db(ABC_company); $Result1 = mysql_query($insertSQL) or die(mysql_error()); $insertGoTo = "../index.php?p=thanks"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } ?> <html> BlaBlaBla </html> <?php include 'closedb.php' ?> I've looked around in your forum but can't seem to find anything 'simple'? Any one have anything? Link to comment https://forums.phpfreaks.com/topic/144801-solved-php-script-to-send-email-from-mysql/ Share on other sites More sharing options...
jstratos Posted February 11, 2009 Author Share Posted February 11, 2009 I figured out how to do this... Link to comment https://forums.phpfreaks.com/topic/144801-solved-php-script-to-send-email-from-mysql/#findComment-759988 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.