Author Topic: Adding A Drop Down Email Address Recipient to A Contact Form  (Read 399 times)

macrat101

  • New Member
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Adding A Drop Down Email Address Recipient to A Contact Form
« on: September 02, 2010, 03:37:31 PM »
[size=medium]I have a contact form that works perfectly ... the forms results are currently being sent to one email address.


There is a drop down "Contact" field on the form, and I would like the forms results to be sent to the persons email address selected from the drop down.


The php lines are    $Contact = $_POST["Contact"];    and   $msg .= "Contact: $Contact\n";


Drop Down Names            Drop Down Email Addresses
Keith                                  keith@xyz.com
John                                  john@xyz.com
Mike                                  mike@xyz.com


Would someone please copy the entire php script below, and paste it into a reply with the drop down names selection function added?


There's a mail headers & mail section at the very bottom, and I think possibly adding another mail header, that references the drop down selection field "Contact" might be close, but honestly I don't have a clue as to what I'm doing.


I can spend all day on this, and still not get it right. However, if I can see how it's written ... I can add the rest email addresses which I didn't list above.


Thank You![/size]
_____________________________________________________________________________________


PHP Code: [Select]
[font=verdana][/size][size=18px]<?php$d date("m-d-y H:i:s");// assign incomming data$CustomerStatus = $_POST["CustomerStatus"];$Contact = $_POST["Contact"];$Name = $_POST["Name"];$an = str_replace(" ", "", $Name);$Company = $_POST["Company"];$Phone = $_POST["Phone"];//$office = $_POST["office"];$Fax = $_POST["Fax"];$Email = $_POST["Email"];$ProjectName = $_POST["ProjectName"];$ProofType = $_POST["ProofType"];$Pages = $_POST["Pages"];$Quantity = $_POST["Quantity"];$ColorFrontBack = $_POST["ColorFrontBack"];$FlatSize = $_POST["FlatSize"];$FoldedSize = $_POST["FoldedSize"];$StockText = $_POST["StockText"];$StockCover = $_POST["StockCover"];$LabelStock = $_POST["LabelStock"];$Coating = $_POST["Coating"];$Bindery = $_POST["Bindery"];$Additional = $_POST["Additional"];$FileType = $_POST["FileType"];$ApplicationType = $_POST["ApplicationType"];$group1 = $_POST["group1"];$group2 = $_POST["group2"];$group3 = $_POST["group3"];$redirect = $_POST["redirect"];      [/size][/font]
// http://www.mysite.com/
//$subject = $_POST["Subject"];     
// Subject is hard coded in the config area, you can use either, comment out the one you dont want to use




/*  *************  Begin Configuration  *************  */
$relocate = "http://www. mysite.com/";   // insert your relocation url here
$home = "http://www. mysitehome.com/";
$MOVE_TO_PATH = '/home/content/x/y/x/xyzaaa/html/FileUpload/';
$PATH_TO_DIR = 'http://www. mysitehome.com/FileUpload/';
// The following values are used to verify_uploaded_file() as the sizes and types that can be uploaded.
$UPLOAD_TYPES['PSD'] = 1;   // Allow .psd files
$UPLOAD_TYPES['JPG'] = 1;   // Allow .jpg files (definition must be upper case)
$UPLOAD_TYPES['JPEG'] = 1;   // Allow .jpeg files
$UPLOAD_TYPES['AI'] = 1;   // Allow .ai files
$UPLOAD_TYPES['EPS'] = 1;   // Allow .eps files
$UPLOAD_TYPES['PDF'] = 1;   // Allow .pdf files
$UPLOAD_TYPES['GIF'] = 1;   // Allow .gif files
$UPLOAD_TYPES['PNG'] = 1;   // Allow .png files
$UPLOAD_TYPES['DOC'] = 1;   // Allow .doc files
$UPLOAD_TYPES['XLS'] = 1;   // Allow .xls files
$UPLOAD_TYPES['ZIP'] = 1;   // Allow .zip files
$UPLOAD_TYPES['SIT'] = 1;   // Allow .sit files
$UPLOAD_TYPES['FLA'] = 1;   // Allow .fla files
$UPLOAD_SIZES['max'] = 180000000;   // Maximum size -- Make sure the file is under 180 MB : 180,000,000 = 180 MB
$UPLOAD_SIZES['min'] = 0;   // Minimum size -- Arbitrary small file size to distinguish between no file and file submission


$sender_name = "My Site Order";
$sender_email = "support@mysitehome.com";
$mailheaders = "Content-Type: text/plain; charset=us-ascii\nFrom: $sender_name <$sender_email>\nReply-To: <$sender_email>\nReturn-Path: <$sender_email>\nX-Mailer: PHP";


//$to = "support@ mysitehome.com";
$to = "support@ mysitehome.com";
$subject = "Order";


$msg ="$d\n\n";
$msg .= "CustomerStatus: $CustomerStatus\n";
$msg .= "Contact: $Contact\n";
$msg .= "Name: $Name\n";
$msg .= "Company: $Company\n";
$msg .= "Phone: $Phone\n";
$msg .= "Fax: $Fax\n";
$msg .= "Email: $Email\n";
$msg .= "ProjectName: $ProjectName\n";
$msg .= "ProofType: $ProofType\n";
$msg .= "Pages: $Pages\n";
$msg .= "Quantity: $Quantity\n";
$msg .= "ColorFrontBack: $ColorFrontBack\n";
$msg .= "FlatSize: $FlatSize\n";
$msg .= "FoldedSize: $FoldedSize\n";
$msg .= "StockText: $StockText\n";
$msg .= "StockCover: $StockCover\n";
$msg .= "LabelStock: $LabelStock\n";
$msg .= "Coating: $Coating\n";
$msg .= "Bindery: $Bindery\n";
$msg .= "Additional: $Additional\n";
$msg .= "FileType: $FileType\n\n";
$msg .= "ApplicationType: $ApplicationType\n";
$msg .= "group1: $group1\n";
$msg .= "group2: $group2\n";
$msg .= "group3: $group3\n";




$success_block = "<p>Thank you for submitting your information. We will review your information and get back to you within a day or two.</p><br><br>";


/*  *************  End Configuration  *************  */




// fn to Check file size and type
function verify_uploaded_file($strName, $intSize) {
   if ($intSize < $GLOBALS['UPLOAD_SIZES']['min'] || $intSize > $GLOBALS['UPLOAD_SIZES']['max']) {
      return -1;
   }
   $arrSegments = split('[.]', $strName); // allow and check multiple dots in filename
   $strExtension = $arrSegments[count($arrSegments) - 1];
   if ($GLOBALS['UPLOAD_TYPES'][strtoupper($strExtension)] != 1) {
      return -2;   // File type not defined/allowed
   }
return 1;   // All tests have passed; this file is valid, return true
} // end fn


function get_extension($filename){
   $arrSegments = split('[.]', $filename);
   $extension = $arrSegments[count($arrSegments) - 1];
return $extension;
}


$head0 = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
<html>


<head>
  <title>Image Upload</title>
  <link href=\"mp.css\" rel=stylesheet>
</head>
<body>
<div align=center>
<br><br>";


$head1 = "<table width=450 cellpadding=5 cellspacing=0 border=1>\n
 <tr>\n
  <td bgcolor=teal align=center><font color=\"#FFFFFF\"><b>Image Upload</b></font></td>\n\n


 </tr><tr>\n
  <td>
";


$head2 = "</td>\n
 </tr></table>
";


// echo $head0;
// echo $head1;


/* begin file upload work */


if ($HTTP_POST_FILES['upload_file1']['name'] != "") {


   //echo 'File 1: ' . $HTTP_POST_FILES['upload_file1']['name'] . '' . '<br>Size: ' . $HTTP_POST_FILES['upload_file1']['size'] . '<br>';
   $intResult = verify_uploaded_file($HTTP_POST_FILES['upload_file1']['name'], $HTTP_POST_FILES['upload_file1']['size']);
   if ($intResult != 1) {
      $msg_base = $HTTP_POST_FILES['upload_file1']['name'] . ' is unacceptable.<p>';
      if ($intResult == -1) {
         $send = "false";
         die($msg_base . 'Reason: File size is too large or non-existent. Please use your Back button to try again.<p>');
      } elseif ($intResult == -2) {
         $send = "false";
         die($msg_base . 'Reason: File type is not allowed. Please use your Back button to try again.<p>');
      }
   }


   if (! move_uploaded_file($HTTP_POST_FILES['upload_file1']['tmp_name'], $MOVE_TO_PATH . $HTTP_POST_FILES['upload_file1']['name']) ) {
      $send = "false";
      die('You did not upload a file or the file could not be moved to ' . $MOVE_TO_PATH . $HTTP_POST_FILES['upload_file1']['name']);
   } else {
      $ext = get_extension($HTTP_POST_FILES['upload_file1']['name']);
      $newname = "$an" . "-1" . ".$ext";
      rename ($MOVE_TO_PATH . $HTTP_POST_FILES['upload_file1']['name'],$MOVE_TO_PATH . $newname);
      $msg .= "$PATH_TO_DIR" . "$newname\n";
      //echo '<p>' . $HTTP_POST_FILES['upload_file1']['name'] . ' was successfully uploaded.<p><a href=' . $PATH_TO_DIR . $newname . ' target=\"_blank\">View File #1 Here</a><p>';
      $send = "true";
   }


} else {
   //echo "No attempt to upload file #1<br>\n\n";
} // end check file requirements






if ($HTTP_POST_FILES['upload_file2']['name'] != "") {
   //echo '<p>File 2: ' . $HTTP_POST_FILES['upload_file2']['name'] . '' . '<br>Size: ' . $HTTP_POST_FILES['upload_file2']['size'] . '<br>';
   $intResult = verify_uploaded_file($HTTP_POST_FILES['upload_file2']['name'], $HTTP_POST_FILES['upload_file2']['size']);
   if ($intResult != 1) {
      $msg_base = $HTTP_POST_FILES['upload_file2']['name'] . ' is unacceptable.<p>';
      if ($intResult == -1) {
         $send = "false";
         die($msg_base . 'Reason: File size is too large or non-existent. Please use your Back button to try again.<p>');
      } elseif ($intResult == -2) {
         $send = "false";
         die($msg_base . 'Reason: File type is not allowed. Please use your Back button to try again.<p>');
      }
   }


   if (! move_uploaded_file($HTTP_POST_FILES['upload_file2']['tmp_name'], $MOVE_TO_PATH . $HTTP_POST_FILES['upload_file2']['name']) ) {
      $send = "false";
      die('You did not upload a file or the file could not be moved to ' . $MOVE_TO_PATH . $HTTP_POST_FILES['upload_file2']['name']);
   } else {
      $ext = get_extension($HTTP_POST_FILES['upload_file2']['name']);
      $newname2 = "$an" . "-2" . ".$ext";
      rename ($MOVE_TO_PATH . $HTTP_POST_FILES['upload_file2']['name'],$MOVE_TO_PATH . $newname2);
      $msg .= "$PATH_TO_DIR" . "$newname2\n";
      //echo '<p>' . $HTTP_POST_FILES['upload_file2']['name'] . ' was successfully uploaded.<p><a href=' . $PATH_TO_DIR . $newname2 . ' target=\"_blank\">View File #2 Here</a><p>';
      $send = "true";
   }


} else {
   //echo "No attempt to upload file #2<br>\n\n";
} // end check file requirements




if ($HTTP_POST_FILES['upload_file3']['name'] != "") {
   //echo '<p>File 3: ' . $HTTP_POST_FILES['upload_file3']['name'] . '' . '<br>Size: ' . $HTTP_POST_FILES['upload_file3']['size'] . '<br>';
   $intResult = verify_uploaded_file($HTTP_POST_FILES['upload_file3']['name'], $HTTP_POST_FILES['upload_file3']['size']);
   if ($intResult != 1) {
      $msg_base = $HTTP_POST_FILES['upload_file3']['name'] . ' is unacceptable.<p>';
      if ($intResult == -1) {
         $send = "false";
         die($msg_base . 'Reason: File size is too large or non-existent. Please use your Back button to try again.<p>');
      } elseif ($intResult == -2) {
         $send = "false";
         die($msg_base . 'Reason: File type is not allowed. Please use your Back button to try again.<p>');
      }
   }


   if (! move_uploaded_file($HTTP_POST_FILES['upload_file3']['tmp_name'], $MOVE_TO_PATH . $HTTP_POST_FILES['upload_file3']['name']) ) {
      $send = "false";
      die('You did not upload a file or the file could not be moved to ' . $MOVE_TO_PATH . $HTTP_POST_FILES['upload_file3']['name']);
   } else {
      $ext = get_extension($HTTP_POST_FILES['upload_file3']['name']);
      $newname3 = "$an" . "-3" . ".$ext";
      rename ($MOVE_TO_PATH . $HTTP_POST_FILES['upload_file3']['name'],$MOVE_TO_PATH . $newname3);
      $msg .= "$PATH_TO_DIR" . "$newname3\n";
      //echo '<p>' . $HTTP_POST_FILES['upload_file3']['name'] . ' was successfully uploaded.<p><a href=' . $PATH_TO_DIR . $newname3 . ' target=\"_blank\">View File #3 Here</a><p>';
      $send = "true";
   }


} else {
   //echo "No attempt to upload file #3<br>\n\n";
} // end check file requirements




if ($HTTP_POST_FILES['upload_file4']['name'] != "") {
   //echo '<p>File 4: ' . $HTTP_POST_FILES['upload_file4']['name'] . '' . '<br>Size: ' . $HTTP_POST_FILES['upload_file4']['size'] . '<br>';
   $intResult = verify_uploaded_file($HTTP_POST_FILES['upload_file4']['name'], $HTTP_POST_FILES['upload_file4']['size']);
   if ($intResult != 1) {
      $msg_base = $HTTP_POST_FILES['upload_file4']['name'] . ' is unacceptable.<p>';
      if ($intResult == -1) {
         $send = "false";
         die($msg_base . 'Reason: File size is too large or non-existent. Please use your Back button to try again.<p>');
      } elseif ($intResult == -2) {
         $send = "false";
         die($msg_base . 'Reason: File type is not allowed. Please use your Back button to try again.<p>');
      }
   }


   if (! move_uploaded_file($HTTP_POST_FILES['upload_file4']['tmp_name'], $MOVE_TO_PATH . $HTTP_POST_FILES['upload_file4']['name']) ) {
      $send = "false";
      die('You did not upload a file or the file could not be moved to ' . $MOVE_TO_PATH . $HTTP_POST_FILES['upload_file4']['name']);
   } else {
      $ext = get_extension($HTTP_POST_FILES['upload_file4']['name']);
      $newname4 = "$an" . "-4" . ".$ext";
      rename ($MOVE_TO_PATH . $HTTP_POST_FILES['upload_file4']['name'],$MOVE_TO_PATH . $newname4);
      $msg .= "$PATH_TO_DIR" . "$newname4\n";
      //echo '<p>' . $HTTP_POST_FILES['upload_file4']['name'] . ' was successfully uploaded.<p><a href=' . $PATH_TO_DIR . $newname4 . ' target=\"_blank\">View File #4 Here</a><p>';
      $send = "true";
   }


} else {
   //echo "No attempt to upload file #4<br>\n\n";
} // end check file requirements




if ($HTTP_POST_FILES['upload_file5']['name'] != "") {
   //echo '<p>File 5: ' . $HTTP_POST_FILES['upload_file5']['name'] . '' . '<br>Size: ' . $HTTP_POST_FILES['upload_file5']['size'] . '<br>';
   $intResult = verify_uploaded_file($HTTP_POST_FILES['upload_file5']['name'], $HTTP_POST_FILES['upload_file5']['size']);
   if ($intResult != 1) {
      $msg_base = $HTTP_POST_FILES['upload_file5']['name'] . ' is unacceptable.<p>';
      if ($intResult == -1) {
         $send = "false";
         die($msg_base . 'Reason: File size is too large or non-existent. Please use your Back button to try again.<p>');
      } elseif ($intResult == -2) {
         $send = "false";
         die($msg_base . 'Reason: File type is not allowed. Please use your Back button to try again.<p>');
      }
   }


   if (! move_uploaded_file($HTTP_POST_FILES['upload_file5']['tmp_name'], $MOVE_TO_PATH . $HTTP_POST_FILES['upload_file5']['name']) ) {
      $send = "false";
      die('You did not upload a file or the file could not be moved to ' . $MOVE_TO_PATH . $HTTP_POST_FILES['upload_file5']['name']);
   } else {
      $ext = get_extension($HTTP_POST_FILES['upload_file5']['name']);
      $newname5 = "$an" . "-5" . ".$ext";
      rename ($MOVE_TO_PATH . $HTTP_POST_FILES['upload_file5']['name'],$MOVE_TO_PATH . $newname5);
      $msg .= "$PATH_TO_DIR" . "$newname5\n";
      // echo '<p>' . $HTTP_POST_FILES['upload_file5']['name'] . ' was successfully uploaded.<p><a href=' . $PATH_TO_DIR . $newname5 . ' target=\"_blank\">View File #5 Here</a><p>';
      $send = "true";
   }


} else {
   //echo "No attempt to upload file #5<br>\n\n";
} // end check file requirements


if ($HTTP_POST_FILES['upload_file6']['name'] != "") {
   //echo '<p>File 6: ' . $HTTP_POST_FILES['upload_file6']['name'] . '' . '<br>Size: ' . $HTTP_POST_FILES['upload_file6']['size'] . '<br>';
   $intResult = verify_uploaded_file($HTTP_POST_FILES['upload_file6']['name'], $HTTP_POST_FILES['upload_file6']['size']);
   if ($intResult != 1) {
      $msg_base = $HTTP_POST_FILES['upload_file6']['name'] . ' is unacceptable.<p>';
      if ($intResult == -1) {
         $send = "false";
         die($msg_base . 'Reason: File size is too large or non-existent. Please use your Back button to try again.<p>');
      } elseif ($intResult == -2) {
         $send = "false";
         die($msg_base . 'Reason: File type is not allowed. Please use your Back button to try again.<p>');
      }
   }


   if (! move_uploaded_file($HTTP_POST_FILES['upload_file6']['tmp_name'], $MOVE_TO_PATH . $HTTP_POST_FILES['upload_file6']['name']) ) {
      $send = "false";
      die('You did not upload a file or the file could not be moved to ' . $MOVE_TO_PATH . $HTTP_POST_FILES['upload_file6']['name']);
   } else {
      $ext = get_extension($HTTP_POST_FILES['upload_file6']['name']);
      $newname6 = "$an" . "-6" . ".$ext";
      rename ($MOVE_TO_PATH . $HTTP_POST_FILES['upload_file6']['name'],$MOVE_TO_PATH . $newname6);
      $msg .= "$PATH_TO_DIR" . "$newname6\n";
      // echo '<p>' . $HTTP_POST_FILES['upload_file6']['name'] . ' was successfully uploaded.<p><a href=' . $PATH_TO_DIR . $newname6 . ' target=\"_blank\">View File #6 Here</a><p>';
      $send = "true";
   }


} else {
   //echo "No attempt to upload file #6<br>\n\n";
} // end check file requirements


if ($HTTP_POST_FILES['upload_file7']['name'] != "") {
   //echo '<p>File 7: ' . $HTTP_POST_FILES['upload_file7']['name'] . '' . '<br>Size: ' . $HTTP_POST_FILES['upload_file7']['size'] . '<br>';
   $intResult = verify_uploaded_file($HTTP_POST_FILES['upload_file7']['name'], $HTTP_POST_FILES['upload_file7']['size']);
   if ($intResult != 1) {
      $msg_base = $HTTP_POST_FILES['upload_file7']['name'] . ' is unacceptable.<p>';
      if ($intResult == -1) {
         $send = "false";
         die($msg_base . 'Reason: File size is too large or non-existent. Please use your Back button to try again.<p>');
      } elseif ($intResult == -2) {
         $send = "false";
         die($msg_base . 'Reason: File type is not allowed. Please use your Back button to try again.<p>');
      }
   }


   if (! move_uploaded_file($HTTP_POST_FILES['upload_file7']['tmp_name'], $MOVE_TO_PATH . $HTTP_POST_FILES['upload_file7']['name']) ) {
      $send = "false";
      die('You did not upload a file or the file could not be moved to ' . $MOVE_TO_PATH . $HTTP_POST_FILES['upload_file7']['name']);
   } else {
      $ext = get_extension($HTTP_POST_FILES['upload_file7']['name']);
      $newname7 = "$an" . "-7" . ".$ext";
      rename ($MOVE_TO_PATH . $HTTP_POST_FILES['upload_file7']['name'],$MOVE_TO_PATH . $newname7);
      $msg .= "$PATH_TO_DIR" . "$newname7\n";
      // echo '<p>' . $HTTP_POST_FILES['upload_file7']['name'] . ' was successfully uploaded.<p><a href=' . $PATH_TO_DIR . $newname7 . ' target=\"_blank\">View File #7 Here</a><p>';
      $send = "true";
   }


} else {
   //echo "No attempt to upload file #7<br>\n\n";
} // end check file requirements


// echo "$success_block";
//echo "<p align=center><a href=\"javascript: history.go(-1)\">Back</a> | <a href=$home>Home</a>";


$my_email = 'support@mysitehome.com';
$mailheaders2 = "Content-Type: text/plain; charset=us-ascii\nFrom: My Printing Company <$my_email>\nReply-To: <$my_email>\nReturn-Path: <$my_email>\nX-Mailer: PHP";


if ($send != "false") {
  mail($to, $subject, $msg, $mailheaders);   // mail sent to admin
  mail($_POST['Email'], $subject, 'Thanks we received your info',$mailheaders2);  // confirmation email
  header("Location: $relocate");
}


?>
« Last Edit: September 02, 2010, 04:00:41 PM by macrat101 »

macrat101

  • New Member
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Adding A Drop Down Email Address Recipient to A Contact Form
« Reply #1 on: September 02, 2010, 03:44:02 PM »
Thanks!
« Last Edit: September 02, 2010, 03:51:44 PM by macrat101 »

phphelp

  • Administrator
  • Senior Member
  • *****
  • Posts: 780
  • Karma: +3/-0
    • View Profile
    • PHP Help forum
Re: Adding A Drop Down Email Address Recipient to A Contact Form
« Reply #2 on: September 02, 2010, 03:50:42 PM »
If you use "php" button in the toolbar to format php code, your code would look like this:
PHP Code: [Select]
<?php
  
echo 'Hello World!';
?>
Are you experienced in PHP programming and willing to share your knowledge?
Join us at php help forum!

phphelp

  • Administrator
  • Senior Member
  • *****
  • Posts: 780
  • Karma: +3/-0
    • View Profile
    • PHP Help forum
Re: Adding A Drop Down Email Address Recipient to A Contact Form
« Reply #3 on: September 02, 2010, 03:59:15 PM »
Add this code to your html form:

PHP Code: [Select]
Contact: <select name="to">
<
option value="keith@xyz.com">Keith</option>
<
option value="john@xyz.com">John</option>
  <
option value="mike@xyz.com">Mike</option>
</
select>


And then modify this line in your php code:
PHP Code: [Select]
$to "support@ mysitehome.com";

to this:
PHP Code: [Select]
$to $_POST["to"];
if(!
in_array(array("keith@xyz.com","john@xyz.com","mike@xyz.com"))) $to "support@mysitehome.com"';
Are you experienced in PHP programming and willing to share your knowledge?
Join us at php help forum!

macrat101

  • New Member
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Adding A Drop Down Email Address Recipient to A Contact Form
« Reply #4 on: September 02, 2010, 04:33:32 PM »
When I added


$to = $_POST["to"];
if(!
in_array(array("keith@xyz.com","john@xyz.com","mike@xyz.com"))) $to = "support@mysitehome.com"';

I get this error:

[size=medium]Parse error[/size][/size][size=medium]: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in[/size][/font][/size][size=medium] [/size][/font][/size][size=medium]/home/content/v/n/d/vndink/html/UP/orders.php[/size][/size][size=medium] [/size][/size][size=medium]on line[/size][/size][size=medium] [/size][/size][size=medium]106[/size][/font][/size][size=medium]
Line 106 is

  if ($intSize < $GLOBALS['UPLOAD_SIZES']['min'] || $intSize > $GLOBALS['UPLOAD_SIZES']['max']) {



Thanks
« Last Edit: September 02, 2010, 04:40:06 PM by macrat101 »

phphelp

  • Administrator
  • Senior Member
  • *****
  • Posts: 780
  • Karma: +3/-0
    • View Profile
    • PHP Help forum
Re: Adding A Drop Down Email Address Recipient to A Contact Form
« Reply #5 on: September 02, 2010, 04:48:51 PM »
There is extra apostrophe at the end of line, I mistyped.

p.s. Something is wrong with your formatting. Try to switch to text mode when entering your text/code (in the toolbar of edit box - there is a button with arrow at right - "Toggle View"
Are you experienced in PHP programming and willing to share your knowledge?
Join us at php help forum!

macrat101

  • New Member
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Adding A Drop Down Email Address Recipient to A Contact Form
« Reply #6 on: September 02, 2010, 05:02:11 PM »
I removed the apostrophe, but am getting this error now

Warning: Wrong parameter count for in_array() in /home/content/v/n/d/vndink/html/UP/orders.php on line 68

Warning: Cannot modify header information - headers already sent by (output started at /home/content/x/y/z/xyzaaa/html/UP/orders.php:68) in /home/content/x/y/z/xyzaaa/html/UP/orders.php on line 375
« Last Edit: September 02, 2010, 05:07:56 PM by macrat101 »

phphelp

  • Administrator
  • Senior Member
  • *****
  • Posts: 780
  • Karma: +3/-0
    • View Profile
    • PHP Help forum
Re: Adding A Drop Down Email Address Recipient to A Contact Form
« Reply #7 on: September 02, 2010, 05:22:54 PM »
Sure! Missed variable that we want to match value in the array. Corrected code is below:

PHP Code: [Select]
$to $_POST["to"];
if(!
in_array($to,array("keith@xyz.com","john@xyz.com","mike@xyz.com"))) $to "support@mysitehome.com";

Are you experienced in PHP programming and willing to share your knowledge?
Join us at php help forum!

macrat101

  • New Member
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Adding A Drop Down Email Address Recipient to A Contact Form
« Reply #8 on: September 02, 2010, 05:47:01 PM »
Woo Hoo ... It Works! Thank You!


Last Question:


Never mind ... I figured it out!
« Last Edit: September 03, 2010, 04:09:34 PM by macrat101 »