?
Solved

Adding to db and send email to multiple recipient at the same time

Posted on 2007-03-19
3
Medium Priority
?
303 Views
Last Modified: 2013-12-13
Hi.

I have this php-code where user adds data to mysql database, but i need that same data to go multiple email recipients (5-10recipients) also. How can i do that ?

--CODE--

<?php
require('qs_connection.php');
require('qs_functions.php');
@session_start();
$row = "";
$err_string = "";
//Check security login
$pagesecure_level = 9;
if (strtoupper(qsrequest("logout"))=="Y") {
    $_SESSION["Order_UserLevel"] = 0;
    $_SESSION["Order_Logon"] = "FALSE";
    $_SESSION["Order_UserLogon"] = "";
    $_SESSION["Order_RedirectURL"] = qssession("firstredirecturl");
    header ("Location: ./order_login.php");
    exit();
}
if (qssession("Order_Logon") != "TRUE") {
    $_SESSION["Order_RedirectURL"] = "./" . rawurlencode("order_add").".php?" . qsservervars("QUERY_STRING");
    header ("Location: ./order_login.php");
    exit();
}
if (qssession("Order_UserLevel") == "") {
    $_SESSION["Order_UserLevel"] = 0;
}
if (qssession("Order_UserLevel") < $pagesecure_level) {
    $_SESSION["Order_Logon"] = "FALSE";
    $_SESSION["Order_RedirectURL"] = "./" . rawurlencode("order_add").".php?" . qsservervars("QUERY_STRING");
    include_once('order_login.php');
    exit();
}

if (isset($_GET["page"])) {
    $current_page = $_GET["page"];
} elseif (isset($_POST["page"])) {
    $current_page = $_POST["page"];
} else {
    $current_page = 1;
}
$quotechar = "`";
$quotedate = "'";
$sql = "";
$sql_ext = "";
$formatdate = array();
$formatdate[0] = "YYYY-MM-DD HH:nn:ss";
$formatdate[1] = "YYYY-MM-DD HH:nn:ss";
$formatdate[2] = "YYYY-MM-DD HH:nn:ss";
$formatdate[3] = "";
$formatdate[4] = "";
$formatdate[5] = "";
$formatdate[6] = "";
$formatdate[7] = "";
$seperatedate = array();
$seperatedate[0] = "-";
$seperatedate[1] = "-";
$seperatedate[2] = "-";
$seperatedate[3] = " ";
$seperatedate[4] = " ";
$seperatedate[5] = " ";
$seperatedate[6] = " ";
$seperatedate[7] = " ";
$sql .= " Select\n";
    $sql .= "     `order`.`Time`,\n";
    $sql .= "     `order`.`Jalleenmyyja`,\n";
    $sql .= "     `order`.`Tilaus pvm`,\n";
    $sql .= "     `order`.`Malli`,\n";
    $sql .= "     `order`.`potkuri`,\n";
    $sql .= "     `order`.`Kaapeli`,\n";
    $sql .= "     `order`.`Toimitusaika`,\n";
    $sql .= "     `order`.`Decado`\n";
    $sql .= " From\n";
    $sql .= "     `order`   `order`\n";

if (isset($_POST["act"])) {
$result = mysql_query($sql . " " . $sql_ext . " limit 0,1")
          or die("Invalid query");
$qry_string = "";
$insert_sql = "";
$value_sql = "";
$hidden_tag = "";
$i = 0;
while ($i < mysql_num_fields($result)) {
    $meta = mysql_fetch_field($result);
    $field_name = $meta->name;
    $field_type = $meta->type;
    $type_field = "";
    $type_field = returntype($field_type);
    if (qsvalidRequest("search_fd" .$i)) {
        if ($qry_string == "") {
            $qry_string = "search_fd" . $i . "=" . urlencode(stripslashes(qsrequest("search_fd" . $i)));
        } else {
            $qry_string .= "&search_fd" .$i . "=" . urlencode(stripslashes(qsrequest("search_fd" . $i)));
        }
        $hidden_tag .= "<input type=\"hidden\" name=\"search_fd" .$i . "\" value=\"" . qsreplace_html_quote(stripslashes(qsrequest("search_fd" . $i))) . "\">\n";
        if ($qry_string == "") {
            $qry_string = "multisearch_fd" . $i . "=" . urlencode(stripslashes(qsrequest("multisearch_fd" . $i)));
        } else {
            $qry_string .= "&multisearch_fd" .$i . "=" . urlencode(stripslashes(qsrequest("multisearch_fd" . $i)));
        }
        $hidden_tag .= "<input type=\"hidden\" name=\"multisearch_fd" .$i . "\" value=\"" . qsreplace_html_quote(stripslashes(qsrequest("multisearch_fd" . $i))) . "\">\n";
    }
    if (qsvalidRequest("add_fd" . $i)) {
        $idata = qsrequest("add_fd" . $i);
        if ($meta) {
            if ($type_field == "type_datetime") {
                    if ($insert_sql == "") {
                        $insert_sql .= $quotechar . $field_name . $quotechar;
                        $value_sql  .= $quotedate . qsconvertdate2ansi($idata,$formatdate[$i],$seperatedate[$i]) .  $quotedate;
                    } else {
                        $insert_sql .= "," . $quotechar . $field_name . $quotechar;
                        $value_sql  .= "," . $quotedate . qsconvertdate2ansi($idata,$formatdate[$i],$seperatedate[$i]) .$quotedate;
                    }
            } elseif ($type_field == "type_integer") {
                if (is_numeric($idata)) {
                    if ($insert_sql == "") {
                        $insert_sql .= $quotechar . $field_name . $quotechar;
                        $value_sql  .= $idata;
                    } else {
                        $insert_sql .= "," . $quotechar . $field_name . $quotechar;
                        $value_sql  .= "," . $idata;
                    }
                } else {
                    $err_string .= "<strong>Error:</strong>while adding<strong>" . $field_name . "</strong>.<br>";
                    $err_string .= "Description: Type mismatch.<br>";
                }
            } elseif ($type_field == "type_string") {
                if ($insert_sql == "") {
                    $insert_sql .= $quotechar . $field_name . $quotechar;
                    $value_sql  .= "'" . ereg_replace("'","''",stripslashes($idata)) . "'";
                } else {
                    $insert_sql .= "," . $quotechar . $field_name . $quotechar;
                    $value_sql  .= ",'" . ereg_replace("'","''",stripslashes($idata)) . "'";
                }
            } else {
                if ($insert_sql == "") {
                    $insert_sql .= $quotechar . $field_name . $quotechar;
                    $value_sql  .= "'" . ereg_replace("'","''",stripslashes($idata)) . "'";
                } else {
                    $insert_sql .= "," . $quotechar . $field_name . $quotechar;
                    $value_sql  .= ",'" . ereg_replace("'","''",stripslashes($idata)) . "'";
                }
            }
        }
    } else {
        if ((strtolower($field_type) != "int identity")
         && (strtolower($field_type) != "autoincrement")
         && (strtolower($field_type) != "counter")) {
            if ($insert_sql == "") {
                $insert_sql .= $quotechar . $field_name . $quotechar;
                $value_sql  .= "null";
            } else {
                $insert_sql .= "," . $quotechar . $field_name . $quotechar;
                $value_sql  .= ", null";
            }
        }
    }
$i++;
}
$sql  = "";
$sql  = "insert into " . $quotechar. mysql_field_table($result,0) . $quotechar;
$sql .= " (" . $insert_sql . ")";
$sql .= " values";
$sql .= " (" . $value_sql . ")";
#----get submit url page----
    $submiturl = "./order.php?";
    if ($result > 0) {mysql_free_result($result);}
    if (!$result = @mysql_query($sql)){
        $err_string .= "<strong>Error:</strong>while updating<br>" . mysql_error();
    }
    if ($err_string == "") {
        if ($qry_string != "") {
            $URL= $submiturl . "&" . $qry_string;
        } else {
            $URL= $submiturl;
        }
        header ("Location: $URL");
        exit;
    }
}
?>
<HTML>
<HEAD>
<Title>Mercury tilauslomake</Title>
<link rel="stylesheet" type="text/css" href="order_add.css">
<script language="javascript">
function Trim(s){
    var temp = " ";
    var i = 0;
    while ((temp == " ") && (i <= s.length)) {
        temp = s.charAt(i);
        i++;
    }
    s = s.substring(i - 1, s.length);
    return(s);
}
function check(frm) {
    var szAlert = "Invalid\n";
    var nIndex = 0;
    if(nIndex > 0) {
             alert(szAlert) ;
            return false ;
    }
    return true ;
}
</script>
<script src="validate.js"></script>

<meta name="generator" content="dbQwikSite Ecommerce">
</HEAD>
<BODY>
<CENTER>
<center>
      <center>&nbsp;</center>
      <center><img alt="logo" hspace="0" src="./images/logo_mercury.gif" align="baseline" border="0" /></center><br />
    </center>

<A NAME=top></A>

<script>
function getURLParam(strParamName){
var strReturn = "";
var strHref = window.location.href;
if ( strHref.indexOf("?") > -1 ){
  var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
  var aQueryString = strQueryString.split("&");
  for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
    if (
      aQueryString[iParam].indexOf(strParamName + "=") > -1 ){
      var aParam = aQueryString[iParam].split("=");
      strReturn = aParam[1];
      break;
    }
  }
}
return strReturn;
}
</script>

<script language="javascript">
//Skip for change list box and keep values

function replaceparamvalue(str, from, to) {
  var idx;
  idx = -1;
  if ((str != null) && (str != "")) {idx = str.indexOf(from)};
  while (idx > -1)  {
        str = str.replace(from, to);
            idx = str.indexOf(from);
  }
  return str;
}

function getparam(items) {
var param;
var page;
var temp;
var avalue;
var aobject;
    param = "";
    temp = items.split(",");
    for(i=0; i <= 8; i++)
    {
      found= "n";
      for(j=0;j<temp.length;j++)
      {
        if(i==temp[j])      {
          found = "y";
        }
      }
      if(found == "n") {
        aobject = null;
        avalue = null;
        aobject = eval("qs_add_form.add_fd" + i);
        if (aobject != null) {
          avalue = replaceparamvalue(aobject.value, "&", "%26");
          if (avalue != "") {
            param = param + "add_fd" + i + "="+ avalue + "&";
          }
        }
      }
    }
    temp = param.substring(param.length, 1);
    if (temp == "&") {
        param = param.substring(0, param.length-1);
    }
    page = "order_add.php?" + param;
    window.location.href=page;
}
</script>

<Form name="qs_add_form" method="post" action="./order_add.php" onSubmit="return check(this)">
<script language='javascript' src='qwikcalendar.js'></script>
<?php
print $hidden_tag;
?>
<Table Border="0" Cellpadding="2" Cellspacing="1" BgColor="#F7F7F7">

<?php
$css_class = "\"TrOdd\"";
?>
<tr>
<td colspan="2" class="ThRows">Mercury tilauslomake</td>
</tr>
<?php
if ($err_string != "") {
    print "<tr>";
    print "<td class=\"ThRows\"><Strong>Error:</Strong></td>";
    print "<td  colspan=\"2\" class=" . $css_class . " align=Default>" . $err_string . "</td>";
    print "</tr>";
}
?>
<tr>
<?php

    $cellvalue = "<input type=\"hidden\" name=\"add_fd0\" value=\" ".date("Y-m-d h:i:s")." \">";
    if ($cellvalue == "") {
        $cellvalue = "&nbsp;";
    }
    print $cellvalue;
?>
<?php

    $cellvalue = "<input type=\"hidden\" name=\"add_fd1\" value=\"". @$_SESSION["Order_UserLogon"] ."\">";
    if ($cellvalue == "") {
        $cellvalue = "&nbsp;";
    }
    print $cellvalue;
?>
<?php

    $cellvalue = "<input type=\"hidden\" name=\"add_fd2\" value=\" ".date("Y-m-d 00:00:00")." \">";
    if ($cellvalue == "") {
        $cellvalue = "&nbsp;";
    }
    print $cellvalue;
?>
<td class="ThRows">Malli</td>
<?php
$cellvalue = "";
if ((!isset($_GET["add_fd3"])) && (!isset($_POST["add_fd3"]))) {
    $itemvalue = "" . $row[3] . "";
} else {
    $itemvalue = qsrequest("add_fd3");
}
    $smasterkeyvalue = "";
    if (qsrequest("add_fd4") != "" ) {
       $smasterkeyvalue = qsrequest("add_fd4");
    } elseif ($row[4] != "") {
       $smasterkeyvalue = $row[4];
    }
    if ($smasterkeyvalue == "") {
        $cellvalue .= "<select name=\"add_fd3\">";

 $cellvalue .= "<option value=\"F2.5 M\"" . qscheckselected("F2.5 M",$itemvalue,"selected") . ">F2.5 M</option>";
 $cellvalue .= "<option value=\"F3.5 M\"" . qscheckselected("F3.5 M",$itemvalue,"selected") . ">F3.5 M</option>";
 $cellvalue .= "<option value=\"F3.5 ML\"" . qscheckselected("F3.5 ML",$itemvalue,"selected") . ">F3.5 ML</option>";
 $cellvalue .= "<option value=\"F4 M\"" . qscheckselected("F4 M",$itemvalue,"selected") . ">F4 M</option>";
 $cellvalue .= "<option value=\"F4 ML\"" . qscheckselected("F4 ML",$itemvalue,"selected") . ">F4 ML</option>";
 $cellvalue .= "<option value=\"F4 ML Sailpower\"" . qscheckselected("F4 ML Sailpower",$itemvalue,"selected") . ">F4 ML Sailpower</option>";
 $cellvalue .= "<option value=\"F5 M\"" . qscheckselected("F5 M",$itemvalue,"selected") . ">F5 M</option>";
 $cellvalue .= "<option value=\"F5 ML\"" . qscheckselected("F5 ML",$itemvalue,"selected") . ">F5 ML</option>";
 $cellvalue .= "<option value=\"F6 M\"" . qscheckselected("F6 M",$itemvalue,"selected") . ">F6 M</option>";
 $cellvalue .= "<option value=\"F6 ML\"" . qscheckselected("F6 ML",$itemvalue,"selected") . ">F6 ML</option>";
 $cellvalue .= "<option value=\"F8 M\"" . qscheckselected("F8 M",$itemvalue,"selected") . ">F8 M</option>";
 $cellvalue .= "<option value=\"F8 ML\"" . qscheckselected("F8 ML",$itemvalue,"selected") . ">F8 ML</option>";
 $cellvalue .= "<option value=\"F8 ELH\"" . qscheckselected("F8 ELH",$itemvalue,"selected") . ">F8 ELH</option>";
 $cellvalue .= "<option value=\"F9.9 M\"" . qscheckselected("F9.9 M",$itemvalue,"selected") . ">F9.9 M</option>";
 $cellvalue .= "<option value=\"F9.9 ML\"" . qscheckselected("F9.9 ML",$itemvalue,"selected") . ">F9.9 ML</option>";
 $cellvalue .= "<option value=\"F9.9 EL\"" . qscheckselected("F9.9 EL",$itemvalue,"selected") . ">F9.9 EL</option>";
 $cellvalue .= "<option value=\"F15 M\"" . qscheckselected("F15 M",$itemvalue,"selected") . ">F15 M</option>";
 $cellvalue .= "<option value=\"F15 ML\"" . qscheckselected("F15 ML",$itemvalue,"selected") . ">F15 ML</option>";
 $cellvalue .= "<option value=\"F15 E\"" . qscheckselected("F15 E",$itemvalue,"selected") . ">F15 E</option>";
 $cellvalue .= "<option value=\"F15 EL\"" . qscheckselected("F15 EL",$itemvalue,"selected") . ">F15 EL</option>";
 $cellvalue .= "<option value=\"F25 M EFI\"" . qscheckselected("F25 M EFI",$itemvalue,"selected") . ">F25 M EFI</option>";
 $cellvalue .= "<option value=\"F25 ML EFI\"" . qscheckselected("F25 ML EFI",$itemvalue,"selected") . ">F25 ML EFI</option>";
 $cellvalue .= "<option value=\"F25 E EFI\"" . qscheckselected("F25 E EFI",$itemvalue,"selected") . ">F25 E EFI</option>";
 $cellvalue .= "<option value=\"F25 EL EFI\"" . qscheckselected("F25 EL EFI",$itemvalue,"selected") . ">F25 EL EFI</option>";
 $cellvalue .= "<option value=\"F25 ELPT EFI\"" . qscheckselected("F25 ELPT EFI",$itemvalue,"selected") . ">F25 ELPT EFI</option>";
 $cellvalue .= "<option value=\"F30 M GA EFI\"" . qscheckselected("F30 M GA EFI",$itemvalue,"selected") . ">F30 M GA EFI</option>";
 $cellvalue .= "<option value=\"F30 ML GA EFI\"" . qscheckselected("F30 ML GA EFI",$itemvalue,"selected") . ">F30 ML GA EFI</option>";
 $cellvalue .= "<option value=\"F30 EL GA EFI\"" . qscheckselected("F30 EL GA EFI",$itemvalue,"selected") . ">F30 EL GA EFI</option>";
 $cellvalue .= "<option value=\"F30 ELPT EFI\"" . qscheckselected("F30 ELPT EFI",$itemvalue,"selected") . ">F30 ELPT EFI</option>";
 $cellvalue .= "<option value=\"F40 E EFI\"" . qscheckselected("F40 E EFI",$itemvalue,"selected") . ">F40 E EFI</option>";
 $cellvalue .= "<option value=\"F40 EL EFI\"" . qscheckselected("F40 EL EFI",$itemvalue,"selected") . ">F40 EL EFI</option>";
 $cellvalue .= "<option value=\"F40 ELPT EFI\"" . qscheckselected("F40 ELPT EFI",$itemvalue,"selected") . ">F40 ELPT EFI</option>";
 $cellvalue .= "<option value=\"F50 ELPT EFI\"" . qscheckselected("F50 ELPT EFI",$itemvalue,"selected") . ">F50 ELPT EFI</option>";
 $cellvalue .= "<option value=\"F60 ELPT EFI\"" . qscheckselected("F60 ELPT EFI",$itemvalue,"selected") . ">F60 ELPT EFI</option>";
 $cellvalue .= "<option value=\"F60 ELPT Big Foot EFI\"" . qscheckselected("F60 ELPT Big Foot EFI",$itemvalue,"selected") . ">F60 ELPT Big Foot EFI</option>";
 $cellvalue .= "<option value=\"80 ELPT 4S\"" . qscheckselected("80 ELPT 4S",$itemvalue,"selected") . ">80 ELPT 4S</option>";
 $cellvalue .= "<option value=\"100 ELPT 4S\"" . qscheckselected("100 ELPT 4S",$itemvalue,"selected") . ">100 ELPT 4S</option>";
 $cellvalue .= "<option value=\"100 EXLPT 4S\"" . qscheckselected("100 EXLPT 4S",$itemvalue,"selected") . ">100 EXLPT 4S</option>";
 $cellvalue .= "<option value=\"115 ELPT 4S\"" . qscheckselected("115 ELPT 4S",$itemvalue,"selected") . ">115 ELPT 4S</option>";
 $cellvalue .= "<option value=\"115 EXLPT 4S\"" . qscheckselected("115 EXLPT 4S",$itemvalue,"selected") . ">115 EXLPT 4S</option>";
 $cellvalue .= "<option value=\"135 L Verado\"" . qscheckselected("135 L Verado",$itemvalue,"selected") . ">135 L Verado</option>";
 $cellvalue .= "<option value=\"135 XL Verado\"" . qscheckselected("135 XL Verado",$itemvalue,"selected") . ">135 XL Verado</option>";
 $cellvalue .= "<option value=\"135 CXL Verado\"" . qscheckselected("135 CXL Verado",$itemvalue,"selected") . ">135 CXL Verado</option>";
 $cellvalue .= "<option value=\"150 L Verado\"" . qscheckselected("150 L Verado",$itemvalue,"selected") . ">150 L Verado</option>";
 $cellvalue .= "<option value=\"150 XL Verado\"" . qscheckselected("150 XL Verado",$itemvalue,"selected") . ">150 XL Verado</option>";
 $cellvalue .= "<option value=\"150 CXL Verado\"" . qscheckselected("150 CXL Verado",$itemvalue,"selected") . ">150 CXL Verado</option>";
 $cellvalue .= "<option value=\"175 L Verado\"" . qscheckselected("175 L Verado",$itemvalue,"selected") . ">175 L Verado</option>";
 $cellvalue .= "<option value=\"175 XL Verado\"" . qscheckselected("175 XL Verado",$itemvalue,"selected") . ">175 XL Verado</option>";
 $cellvalue .= "<option value=\"175 CXL Verado\"" . qscheckselected("175 CXL Verado",$itemvalue,"selected") . ">175 CXL Verado</option>";
 $cellvalue .= "<option value=\"200 L Verado\"" . qscheckselected("200 L Verado",$itemvalue,"selected") . ">200 L Verado</option>";
 $cellvalue .= "<option value=\"200 XL Verado\"" . qscheckselected("200 XL Verado",$itemvalue,"selected") . ">200 XL Verado</option>";
 $cellvalue .= "<option value=\"200 CXL Verado\"" . qscheckselected("200 CXL Verado",$itemvalue,"selected") . ">200 CXL Verado</option>";
 $cellvalue .= "<option value=\"225 L Verado\"" . qscheckselected("225 L Verado",$itemvalue,"selected") . ">225 L Verado</option>";
 $cellvalue .= "<option value=\"225 XL Verado\"" . qscheckselected("225 XL Verado",$itemvalue,"selected") . ">225 XL Verado</option>";
 $cellvalue .= "<option value=\"225 CXL Verado\"" . qscheckselected("225 CXL Verado",$itemvalue,"selected") . ">225 CXL Verado</option>";
 $cellvalue .= "<option value=\"225 XXL Verado\"" . qscheckselected("225 XXL Verado",$itemvalue,"selected") . ">225 XXL Verado</option>";
 $cellvalue .= "<option value=\"225 CXXL Verado\"" . qscheckselected("225 CXXL Verado",$itemvalue,"selected") . ">225 CXXL Verado</option>";
 $cellvalue .= "<option value=\"250 L Verado\"" . qscheckselected("250 L Verado",$itemvalue,"selected") . ">250 L Verado</option>";
 $cellvalue .= "<option value=\"250 XL Verado\"" . qscheckselected("250 XL Verado",$itemvalue,"selected") . ">250 XL Verado</option>";
 $cellvalue .= "<option value=\"250 CXL Verado\"" . qscheckselected("250 CXL Verado",$itemvalue,"selected") . ">250 CXL Verado</option>";
 $cellvalue .= "<option value=\"250 XXL Verado\"" . qscheckselected("250 XXL Verado",$itemvalue,"selected") . ">250 XXL Verado</option>";
 $cellvalue .= "<option value=\"250 CXXL Verado\"" . qscheckselected("250 CXXL Verado",$itemvalue,"selected") . ">250 CXXL Verado</option>";
 $cellvalue .= "<option value=\"275 L Verado\"" . qscheckselected("275 L Verado",$itemvalue,"selected") . ">275 L Verado</option>";
 $cellvalue .= "<option value=\"275 XL Verado\"" . qscheckselected("275 XL Verado",$itemvalue,"selected") . ">275 XL Verado</option>";
 $cellvalue .= "<option value=\"275 CXL Verado\"" . qscheckselected("275 CXL Verado",$itemvalue,"selected") . ">275 CXL Verado</option>";
 $cellvalue .= "<option value=\"275 XXL Verado\"" . qscheckselected("275 XXL Verado",$itemvalue,"selected") . ">275 XXL Verado</option>";
 $cellvalue .= "<option value=\"275 CXXL Verado\"" . qscheckselected("275 CXXL Verado",$itemvalue,"selected") . ">275 CXXL Verado</option>";
        $cellvalue .= "</select>";
    }else{

    $cellvalue = "<select name=\"add_fd3\" onChange=\"getparam('4');\"><option value=\"F2.5 M\"" . qscheckselected("F2.5 M",$itemvalue,"selected") . ">F2.5 M</option><option value=\"F3.5 M\"" . qscheckselected("F3.5 M",$itemvalue,"selected") . ">F3.5 M</option><option value=\"F3.5 ML\"" . qscheckselected("F3.5 ML",$itemvalue,"selected") . ">F3.5 ML</option><option value=\"F4 M\"" . qscheckselected("F4 M",$itemvalue,"selected") . ">F4 M</option><option value=\"F4 ML\"" . qscheckselected("F4 ML",$itemvalue,"selected") . ">F4 ML</option><option value=\"F4 ML Sailpower\"" . qscheckselected("F4 ML Sailpower",$itemvalue,"selected") . ">F4 ML Sailpower</option><option value=\"F5 M\"" . qscheckselected("F5 M",$itemvalue,"selected") . ">F5 M</option><option value=\"F5 ML\"" . qscheckselected("F5 ML",$itemvalue,"selected") . ">F5 ML</option><option value=\"F6 M\"" . qscheckselected("F6 M",$itemvalue,"selected") . ">F6 M</option><option value=\"F6 ML\"" . qscheckselected("F6 ML",$itemvalue,"selected") . ">F6 ML</option><option value=\"F8 M\"" . qscheckselected("F8 M",$itemvalue,"selected") . ">F8 M</option><option value=\"F8 ML\"" . qscheckselected("F8 ML",$itemvalue,"selected") . ">F8 ML</option><option value=\"F8 ELH\"" . qscheckselected("F8 ELH",$itemvalue,"selected") . ">F8 ELH</option><option value=\"F9.9 M\"" . qscheckselected("F9.9 M",$itemvalue,"selected") . ">F9.9 M</option><option value=\"F9.9 ML\"" . qscheckselected("F9.9 ML",$itemvalue,"selected") . ">F9.9 ML</option><option value=\"F9.9 EL\"" . qscheckselected("F9.9 EL",$itemvalue,"selected") . ">F9.9 EL</option><option value=\"F15 M\"" . qscheckselected("F15 M",$itemvalue,"selected") . ">F15 M</option><option value=\"F15 ML\"" . qscheckselected("F15 ML",$itemvalue,"selected") . ">F15 ML</option><option value=\"F15 E\"" . qscheckselected("F15 E",$itemvalue,"selected") . ">F15 E</option><option value=\"F15 EL\"" . qscheckselected("F15 EL",$itemvalue,"selected") . ">F15 EL</option><option value=\"F25 M EFI\"" . qscheckselected("F25 M EFI",$itemvalue,"selected") . ">F25 M EFI</option><option value=\"F25 ML EFI\"" . qscheckselected("F25 ML EFI",$itemvalue,"selected") . ">F25 ML EFI</option><option value=\"F25 E EFI\"" . qscheckselected("F25 E EFI",$itemvalue,"selected") . ">F25 E EFI</option><option value=\"F25 EL EFI\"" . qscheckselected("F25 EL EFI",$itemvalue,"selected") . ">F25 EL EFI</option><option value=\"F25 ELPT EFI\"" . qscheckselected("F25 ELPT EFI",$itemvalue,"selected") . ">F25 ELPT EFI</option><option value=\"F30 M GA EFI\"" . qscheckselected("F30 M GA EFI",$itemvalue,"selected") . ">F30 M GA EFI</option><option value=\"F30 ML GA EFI\"" . qscheckselected("F30 ML GA EFI",$itemvalue,"selected") . ">F30 ML GA EFI</option><option value=\"F30 EL GA EFI\"" . qscheckselected("F30 EL GA EFI",$itemvalue,"selected") . ">F30 EL GA EFI</option><option value=\"F30 ELPT EFI\"" . qscheckselected("F30 ELPT EFI",$itemvalue,"selected") . ">F30 ELPT EFI</option><option value=\"F40 E EFI\"" . qscheckselected("F40 E EFI",$itemvalue,"selected") . ">F40 E EFI</option><option value=\"F40 EL EFI\"" . qscheckselected("F40 EL EFI",$itemvalue,"selected") . ">F40 EL EFI</option><option value=\"F40 ELPT EFI\"" . qscheckselected("F40 ELPT EFI",$itemvalue,"selected") . ">F40 ELPT EFI</option><option value=\"F50 ELPT EFI\"" . qscheckselected("F50 ELPT EFI",$itemvalue,"selected") . ">F50 ELPT EFI</option><option value=\"F60 ELPT EFI\"" . qscheckselected("F60 ELPT EFI",$itemvalue,"selected") . ">F60 ELPT EFI</option><option value=\"F60 ELPT Big Foot EFI\"" . qscheckselected("F60 ELPT Big Foot EFI",$itemvalue,"selected") . ">F60 ELPT Big Foot EFI</option><option value=\"80 ELPT 4S\"" . qscheckselected("80 ELPT 4S",$itemvalue,"selected") . ">80 ELPT 4S</option><option value=\"100 ELPT 4S\"" . qscheckselected("100 ELPT 4S",$itemvalue,"selected") . ">100 ELPT 4S</option><option value=\"100 EXLPT 4S\"" . qscheckselected("100 EXLPT 4S",$itemvalue,"selected") . ">100 EXLPT 4S</option><option value=\"115 ELPT 4S\"" . qscheckselected("115 ELPT 4S",$itemvalue,"selected") . ">115 ELPT 4S</option><option value=\"115 EXLPT 4S\"" . qscheckselected("115 EXLPT 4S",$itemvalue,"selected") . ">115 EXLPT 4S</option><option value=\"135 L Verado\"" . qscheckselected("135 L Verado",$itemvalue,"selected") . ">135 L Verado</option><option value=\"135 XL Verado\"" . qscheckselected("135 XL Verado",$itemvalue,"selected") . ">135 XL Verado</option><option value=\"135 CXL Verado\"" . qscheckselected("135 CXL Verado",$itemvalue,"selected") . ">135 CXL Verado</option><option value=\"150 L Verado\"" . qscheckselected("150 L Verado",$itemvalue,"selected") . ">150 L Verado</option><option value=\"150 XL Verado\"" . qscheckselected("150 XL Verado",$itemvalue,"selected") . ">150 XL Verado</option><option value=\"150 CXL Verado\"" . qscheckselected("150 CXL Verado",$itemvalue,"selected") . ">150 CXL Verado</option><option value=\"175 L Verado\"" . qscheckselected("175 L Verado",$itemvalue,"selected") . ">175 L Verado</option><option value=\"175 XL Verado\"" . qscheckselected("175 XL Verado",$itemvalue,"selected") . ">175 XL Verado</option><option value=\"175 CXL Verado\"" . qscheckselected("175 CXL Verado",$itemvalue,"selected") . ">175 CXL Verado</option><option value=\"200 L Verado\"" . qscheckselected("200 L Verado",$itemvalue,"selected") . ">200 L Verado</option><option value=\"200 XL Verado\"" . qscheckselected("200 XL Verado",$itemvalue,"selected") . ">200 XL Verado</option><option value=\"200 CXL Verado\"" . qscheckselected("200 CXL Verado",$itemvalue,"selected") . ">200 CXL Verado</option><option value=\"225 L Verado\"" . qscheckselected("225 L Verado",$itemvalue,"selected") . ">225 L Verado</option><option value=\"225 XL Verado\"" . qscheckselected("225 XL Verado",$itemvalue,"selected") . ">225 XL Verado</option><option value=\"225 CXL Verado\"" . qscheckselected("225 CXL Verado",$itemvalue,"selected") . ">225 CXL Verado</option><option value=\"225 XXL Verado\"" . qscheckselected("225 XXL Verado",$itemvalue,"selected") . ">225 XXL Verado</option><option value=\"225 CXXL Verado\"" . qscheckselected("225 CXXL Verado",$itemvalue,"selected") . ">225 CXXL Verado</option><option value=\"250 L Verado\"" . qscheckselected("250 L Verado",$itemvalue,"selected") . ">250 L Verado</option><option value=\"250 XL Verado\"" . qscheckselected("250 XL Verado",$itemvalue,"selected") . ">250 XL Verado</option><option value=\"250 CXL Verado\"" . qscheckselected("250 CXL Verado",$itemvalue,"selected") . ">250 CXL Verado</option><option value=\"250 XXL Verado\"" . qscheckselected("250 XXL Verado",$itemvalue,"selected") . ">250 XXL Verado</option><option value=\"250 CXXL Verado\"" . qscheckselected("250 CXXL Verado",$itemvalue,"selected") . ">250 CXXL Verado</option><option value=\"275 L Verado\"" . qscheckselected("275 L Verado",$itemvalue,"selected") . ">275 L Verado</option><option value=\"275 XL Verado\"" . qscheckselected("275 XL Verado",$itemvalue,"selected") . ">275 XL Verado</option><option value=\"275 CXL Verado\"" . qscheckselected("275 CXL Verado",$itemvalue,"selected") . ">275 CXL Verado</option><option value=\"275 XXL Verado\"" . qscheckselected("275 XXL Verado",$itemvalue,"selected") . ">275 XXL Verado</option><option value=\"275 CXXL Verado\"" . qscheckselected("275 CXXL Verado",$itemvalue,"selected") . ">275 CXXL Verado</option></select>";
    }
    if ($cellvalue == "") {
        $cellvalue = "&nbsp;";
    }
    print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>";
?>
</tr>
<tr>
<td class="ThRows">Potkuri</td>
<?php
$cellvalue = "";
if ((!isset($_GET["add_fd4"])) && (!isset($_POST["add_fd4"]))) {
    $itemvalue = "";
} else {
    $itemvalue = qsrequest("add_fd4");
}
    $smasterkeyvalue = "";
    if (qsrequest("add_fd3") != "" ) {
       $smasterkeyvalue = qsrequest("add_fd3");
    } elseif ($row[3] != "") {
       $smasterkeyvalue = $row[3];
    }
    if ($smasterkeyvalue == "") {
        $cellvalue .= "<select name=\"add_fd4\">";

 $cellvalue .= "<option value=\"Vakio\"" . qscheckselected("Vakio",$itemvalue,"selected") . ">Vakio tässä mallissa!</option>";
 $cellvalue .= "<option value=\"potkuri\"" . qscheckselected("potkuri",$itemvalue,"selected") . ">Potkuri</option>";
 $cellvalue .= "<option value=\"potkuri 2\"" . qscheckselected("potkuri 2",$itemvalue,"selected") . ">Potkuri 2</option>";
        $cellvalue .= "</select>";
    }else{

    $cellvalue = "<select name=\"add_fd4\" onChange=\"getparam('3');\">" . qsmysqlgen_listbox("  Select Distinct `potkuri`,`potkuri`,`potkuri` From `order` Where potkuri ='" . $smasterkeyvalue . "' Order by `potkuri` Asc ","add_fd4","potkuri","potkuri",$itemvalue) . "<option value=\"Vakio\"" . qscheckselected("Vakio",$itemvalue,"selected") . ">Vakio tässä mallissa!</option><option value=\"potkuri\"" . qscheckselected("potkuri",$itemvalue,"selected") . ">Potkuri</option><option value=\"potkuri 2\"" . qscheckselected("potkuri 2",$itemvalue,"selected") . ">Potkuri 2</option></select>";
    }
    if ($cellvalue == "") {
        $cellvalue = "&nbsp;";
    }
    print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>";
?>
</tr>
<tr>
<td class="ThRows">Kaapeli</td>
<?php
$cellvalue = "";
if ((!isset($_GET["add_fd5"])) && (!isset($_POST["add_fd5"]))) {
    $itemvalue = "";
} else {
    $itemvalue = qsrequest("add_fd5");
}
    $smasterkeyvalue = "";
    if (qsrequest("add_fd3") != "" ) {
       $smasterkeyvalue = qsrequest("add_fd3");
    } elseif ($row[3] != "") {
       $smasterkeyvalue = $row[3];
    }
    if ($smasterkeyvalue == "") {
        $cellvalue .= "<select name=\"add_fd5\">";

 $cellvalue .= "<option value=\"vakio\"" . qscheckselected("vakio",$itemvalue,"selected") . ">Vakio tässä mallissa!</option>";
 $cellvalue .= "<option value=\"kaapeli\"" . qscheckselected("kaapeli",$itemvalue,"selected") . ">kaapeli</option>";
        $cellvalue .= "</select>";
    }else{

    $cellvalue = "<select name=\"add_fd5\" >" . qsmysqlgen_listbox("  Select Distinct `Kaapeli`,`Kaapeli`,`potkuri` From `order` Where potkuri ='" . $smasterkeyvalue . "' Order by `Kaapeli` Asc ","add_fd5","Kaapeli","Kaapeli",$itemvalue) . "<option value=\"vakio\"" . qscheckselected("vakio",$itemvalue,"selected") . ">Vakio tässä mallissa!</option><option value=\"kaapeli\"" . qscheckselected("kaapeli",$itemvalue,"selected") . ">kaapeli</option></select>";
    }
    if ($cellvalue == "") {
        $cellvalue = "&nbsp;";
    }
    print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>";
?>
</tr>
<tr>
<td class="ThRows">Toimitusaika</td>
<?php
$cellvalue = "";
if ((!isset($_GET["add_fd6"])) && (!isset($_POST["add_fd6"]))) {
    $itemvalue = "";
        if ($itemvalue == "") {
            $itemvalue = qsconvertdate(date("Y-m-d h:i:s"),"dd-mm-yyyy");
        }
} else {
    $itemvalue = qsrequest("add_fd6");
}

    $cellvalue = "<input type=\"text\" name=\"add_fd6\" value=\"" . qsreplace_html_quote(stripslashes($itemvalue)) . "\"><a href=\"#add_fd6\"><a name=\"add_fd6\"><img src=\"images/Calendar.gif\" width=\"20\" height=\"21\" border=0 align=\"absmiddle\" onClick=\"popUpCalendar(this, document.forms[0].add_fd6, 'dd-mm-yyyy', 0, 0)\"></a>";
    if ($cellvalue == "") {
        $cellvalue = "&nbsp;";
    }
    print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>";
?>
</tr>
<tr>
<td class="ThRows">Verado</td>
<?php
$cellvalue = "";
if ((!isset($_GET["add_fd7"])) && (!isset($_POST["add_fd7"]))) {
    $itemvalue = "" . $row[7] . "";
} else {
    $itemvalue = qsrequest("add_fd7");
}

    $cellvalue = "<input type=\"radio\" name=\"add_fd7\" value=\"Kaukohallintalaite sivuasennus\"" . qscheckselected("Kaukohallintalaite sivuasennus",$itemvalue,"Checked") . ">Kaukohallintalaite sivuasennus<br><input type=\"radio\" name=\"add_fd7\" value=\"Kaukohallintalaite konsoliasennus \"" . qscheckselected("Kaukohallintalaite konsoliasennus ",$itemvalue,"Checked") . ">Kaukohallintalaite konsoliasennus <br><input type=\"radio\" name=\"add_fd7\" value=\"Kaukohallintalaite konsoliasennus kapea malli \"" . qscheckselected("Kaukohallintalaite konsoliasennus kapea malli ",$itemvalue,"Checked") . ">Kaukohallintalaite konsoliasennus kapea malli <br>";
    if ($cellvalue == "") {
        $cellvalue = "&nbsp;";
    }
    print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>";
?>
</tr>
<?php
#----get back url page----
  $backurl = "./order.php?";
?>
<tr>
<td class="ThRows">&nbsp;</td>
<td class="TrOdd" align=Default>
<input type="hidden" name="act" value="n">
<input type="button" name="QS_Back" value="Back" OnClick="javascript:window.location='<?php print $backurl; ?>'">&nbsp;&nbsp;
<input type="submit" name="QS_Submit" value="Add">&nbsp;&nbsp;
<input type="reset" name="QS_Reset" value="Reset">
</td>
</tr>
</Table><br>
</Form>
<?php
if ($result > 0) {mysql_free_result($result);}
if ($link > 0) {mysql_close($link);}
?>
<A NAME=bottom></A>
</Center>

</BODY>
</HTML>
0
Comment
Question by:Toube
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
Aamir Saeed earned 1000 total points
ID: 18751003
sry to read complete code is a bit difficult but just to give you an idea

step1; get emai from DB
step2; loop thru and use mail() to send email to all

for example,

$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
   'Reply-To: webmaster@example.com' . "\r\n" .
   'X-Mailer: PHP/' . phpversion();

$result = mysql_query("SELECT id, name, email FROM mytable");

while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
   mail($row['email'], $subject, $message, $headers);
}
0
 

Author Comment

by:Toube
ID: 18828479
Hello,

I have made table where is user and email..

But where i put that in the code ?
0
 

Author Comment

by:Toube
ID: 18828535
Please help me with this one..

There is a table called perhe1, and values:

 Id,Asiakas numero,Pvm,Malli,Kpl,Toivottu toimitusaika,Kommentti,Vapaa 1,Vapaa 2,Vapaa 3,Kuittaus,Tiedot,Muokkaa,Poista

Customer logs in and fill Malli, kpl, Toivottu toimitusaika and Kommentti. Other values are hidden fields..
Everything goes to db, but what i need is: id,asiakasnumero,pvm,malli,kpl,Toivottu toimitusaika and kommentti goes to specific email address or addresses..

If someone could insert needed code on my code it would be great help for me.. and all i need to do is just type email addresses.
Thank You
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question