php - How to set up a mailing list site manager to bulk send newsletter to customers -


i have mailing list form sign mailing list , input details database. want admin section user can create email within website , send people have signed mailing list. how can this?

here code creating mailing list:

<?php // start session handler require_once('dbfunction.php');  //connect database $conn2 = db2();  require_once('header.php');  /* *   should proceed form (if page not submitted echo form) */ if (isset($_post['submit'])) {  //detect if have errors or not $errors = false; $error_msg = "error, please try again";   if (!isset($_post['full_name']) || $_post['full_name'] == "") {  $errors = true;     echo "<p style='color: red; position: absolute; top:115.5em; right:28em;'>enter full name</p>"; }  if (!isset($_post['email']) || $_post['email'] == "") { $errors = true;     echo "<p style='color: red; position: absolute; top:120.1em; right:25.7em;'>enter email</p>"; }  $email = $_post['email'];  //prepare , set query , execute $stmt = $conn2->prepare("select count(email) maillist email = ?"); $stmt->bind_param('s',$email); $stmt->execute(); $stmt->bind_result($count); while($stmt->fetch()){}  if(!empty($count)){      echo "<p class='red'>email registered, please enter alternative email</p>";  } else  //if have no errors, sql if (!$errors) { $full_name = $_post['full_name']; $full_name = ucfirst($full_name);  //insert data $stmt = $conn2->prepare("insert maillist (billing_name, email) values (?, ?)");  //bind parameters $stmt->bind_param('ss', $full_name, $email);  // execute query $stmt->execute();  //if query worked, put out confirmation message (you can make want) if ($stmt) {   echo "<p class='black'>thank joining out mailing list</p>";  //put out footer , stop rest of script running, don't display rest of form (this after form has been submitted) require_once('footer.php'); exit; } } } 

admin control panel (acp) aka backoffice can written php easily. can create new file or folder follow next "logic":

1.is member logged-in , has permissions acp? (sessions/cookies)

2.if not , print login form , check details.

2.1 if details exists in db admin table - create cookie or session.

3.if logged in show him acp.

there option admin write email , send of subscribers. (according needs).

so need have simple form 2 fields: subject , message (content). when submit form , run php script do:

1.get data of form ($_post['title'] example)

2.fetch subscribers database loop (while)

3.and while fetching them , send them email mail function.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -