Have an account? Sign in
Login  Register  Facebook
how to make a newsletter using php 5 and mysqli
how to make a news letter with php and mysqli

this is the user interface


<?php 
  
  $company_name = "";
  $company_email = "";
  $user_msg = "";
  
  if ($_POST['company_name'] !=""){
      
      include_once ("/config/config.php");

                $name = $_POST['company_name'];
                $email = $_POST['company_email'];
                
                $sql = " select * from maling_list where email = '$company_email' ";
                $numRows = mysql_num_rows ($sql);
      if(!$email){
          
          $user_msg = "Please type your email address $company_name";
          
          }else{
              
              if ($numRows > 0) {
                  
                  $user_msg = " This Email address you trying to input is already exists ";
                  
                  }else{
                      
                      $qput_co = " insert into maling_list (company, email) values ('$name', '$email') " ;
                      $qresult = $db -> query ($qput_co) or die ($db->error);
                      
                      $user_msg = "Thanks $company_name You have been added successfilly to our mailing list";
                      echo "Name" . $company_name;
                      echo "Email" . $company_email;
                      
                      }
              
              }
      }
  
   ?>

<div id="maling_list_area">
  <form style="width:230px;" action="<?php $_SERVER['PHP_SELF'] ?>" method="post">
  
  <fieldset style="text-align:left; padding:10px;">
  <legend>Put youe self in our mailing list</legend>
  <br />
  Company : <br />
  <input name="company_name" type="text" maxlength="40" value="<?php echo $company_name; ?>" />
  <br />
  Email : <br />
  <input name="company_email" type="text" maxlength="60" value="<?php echo $company_email; ?>" />
  <br /><br />
  <input type="submit" name="submit" id="submit" value="Submit" />
  <?php echo $user_msg; ?>
  
  </fieldset>
  </form>  
</div>
and this is the admin interface
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Mailing list</title>
<style type="text/css">
#select {
    padding: 5px;
    list-style-position: inside;
    list-style-type: none;
}
</style>
</head>

<body>

        <?php 
                
        $get_U_data = " select * from maling_list ";
        $result = $db -> query ($get_U_data) or die ($db->error);
        if ($result) {
            
            while ($row = $result -> fetch_object()) {
                
                
                ?>
                
     <div id="main_control">           

<h2>Send your newsletter</h2>
    

<form action="mailit.php" method="post" >
<table width="700" border="0" cellspacing="0" cellpadding="5" class="margin_on_tables">
  <tr>
    <td><label for="category">Category</label></td>
    <td align="center"><strong>Receptors</strong></td>
  </tr>
  <tr>
    <td><select name="category">
            <option value="1">option1</option>
            <option value="2">option2</option>
            <option value="3">option3</option>
            <option value="4">option4</option>
    </select></td>
    <td rowspan="5" align="center" valign="top"><label for="select"></label>
      <select name="select" size="15" multiple="multiple" id="select">
      <option>--------------</option>
      <?php 
      while ($row = $result -> fetch_object()) {
      ?>
      <option><?php echo $row->company ?><br /></option>

      <?php
                }

            }       

         ?>

         <option>--------------</option>

    </select></td>
  </tr>
  <tr>
    <td><label for="subject">Subject</label></td>
  </tr>
  <tr>
    <td><input type="text" name="subject" /></td>
  </tr>
  <tr>
    <td>Message</td>
  </tr>
  <tr>
    <td><textarea name="body" cols="60" rows="15"></textarea></td>
  </tr>
  <tr>
    <td align="center"><input type="submit" name="submit" value="Send" /></td>
    <td align="center"><a href="#"><strong>Manage reseptors</strong></a></td>
  </tr>
</table>

</form>
Started: September 21, 2011 Latest Activity: June 2, 2018 php mysql

ok please tell me where is the error or what are you want exactly
September 21, 2011

8 Answers
Viagra Non Prescription Propecia Works Men Kamagra Vendita Spagna <a href=http://buyciali.com>generic cialis from india</a> Recommended Dosages For Cephalexin Nuovo Viagra Napoli

Posted: Ellgaibra
In: June 2, 2018

cialis coupons printable <a href="http://cialisonl.com/ ">buy cialis</a>
legalidad de comprar cialis <a href=http://cialisonl.com/>cialis vs viagra</a>
buy viagra low cost <a href="http://viagraessale.com/ ">Viagra great britain</a>
safe place to buy viagra online <a href=http://viagrayosale.com/>Viagra 5 mg</a>
cialis price in bangalore http://cialisonl.com/
vaigra http://viagravonline.com/#canadian-viagra

Posted: online cialis
In: May 12, 2018

precios cialis peru <a href="http://sfghjkuyiolki.com/#">cialis lowest price</a> cialis price thailand <a href=http://sfghjkuyiolki.com/#>cialis kaufen</a>

Posted: RobertBrugs
In: April 23, 2018

沒有醫生的處方
cialis purchasing
<a href="http://cialisvipsale.com/#">cialis 20mg prix en pharmacie</a>
sildenafil buy uk
<a href=http://viagrayosale.com/#>Buy viagra online</a>

Posted: cialisyoues.com
In: April 16, 2018

cialis coupons printable

is female cialis legal in uk cialis y otros medicamentos purchase generic female cialis is cialis 50mg generic fake cialis bugiardin wow best way to use cialis indio cialis genrico <a href="http://cialiscoupon2018.com/#cialis-coupons-printable">cialis for daily use</a> cuanto cuesta cialis yahoo <a href="http://cialiscoupon2018.com/#cialis-patient-assistance">coupon for cialis by manufacturer</a> vente medicament cialis india cialis paymentpaypal cialis diario compra cialis 5 mg principio attivo cialis 20 mg 8 compresse cialis mg acquisto on line only today 5 mg cialis cialis and purchase acheter cialis pas cher france taking cialis and alcohol cialis 5 mg principio attivo generisches cialis en ligne cialis cura prostata <a href="http://cialiscoupon2018.com/#what-is-the-cost-of-cialis">coupon for cialis by manufacturer</a> cialis generico dalla svizzera <a href="http://cialiscoupon2018.com/#cialis-5mg-daily-use-cost">coupon for cialis by manufacturer</a> 20 mg cialis cost rite aid cialis con paypal cheapest generic cialis uk usefull link cialis overnite vente medicament cialis buying cialis in toronto
http://cialiscoupon2018.com/

Posted: LRkobrstimpow
In: March 29, 2018

what about use Newsletter system:

Posted: Gamal
In: September 21, 2011

Thanks jooria for replaying to me but is there is no other way to do it rather then zend framework I didn\'t use zend framework before please jooria take a look at this and tell me what you think about it, http://www.plus2net.com/articles/php_newsletter_script.php
I want to understand this part of the code
while($rowdata=mysql_fetch_array($result))
{
$msg2=$msg.\"<BR>To unsubscribe <a     href=$pt2\".\"unsub.php?email=$rowdata[em]>Click HERE</a>\";
mail($rowdata[em],$sub,$msg2,\"$mail_type\");
}//end of while loop


I think my problem is here

Posted: johnef_sh
In: September 21, 2011

this part make a loop to send the mails to the users by mail()
September 21, 2011

Thanks Gamal again for replaying to me but sir I'd like to know the full script of this part, how to make the looping in simple way and send the mail to all the users that I have Thanks again Gamal
September 21, 2011

try zend framework , mail class, its easy to implement and use. even for newsletter script.
//FUNCTION TO SEND EMAIL VIA ZEND MAIL
function sendEmail($params){
    require_once ('Zend/Mail.php');
    $mail = new Zend_Mail();
    if (!empty($params['bodyText'])) $mail->setBodyText($params['bodyText']);
    if (!empty($params['bodyHtml'])) $mail->setBodyHtml($params['bodyHtml']);
    $mail->setFrom($params['fromEmail'], $params['fromName']);
    $mail->addTo($params['toEmail'], $params['toName']);
    if (!empty($params['bccEmail']) && !empty($params['bccName'])) $mail->addBcc($params['bccEmail'], $params['bccName']); 
    $mail->setSubject($params['subject']);
    if (!empty($params['attachFile']) && file_exists($params['attachFile'])){
        $at = $mail->addAttachment(file_get_contents($params['attachFile']));
        $at->type        = $params['attachType'];
        $at->disposition = Zend_Mime::DISPOSITION_ATTACHMENT;
        $at->filename    = $params['attachName'];
    }
    $mail->send();
}

Posted: Go
In: September 21, 2011

Your Answer

xDo you want to answer this question? Please login or create an account to post your answer