Jump to content


Photo

Form Arrays & Mail Functions


  • Please log in to reply
2 replies to this topic

#1 cattledogz

cattledogz
  • Members
  • Pip
  • Newbie
  • 8 posts

Posted 23 March 2006 - 09:35 PM

I've been working on this html form.. It is rather long...

Needless to say, I want to take all the imput data and email it...

I got that part working.. But I am having problems with the "multiple" options arrays.. I can get it to echo on my page, but I can't seem to figure out how to get it in the email... here's my code:

<?
  $application = $_POST["application"];  
  $applicationOtherComments = $_POST['applicationOtherComments'];
  $RequireSoftware = $_POST['RequireSoftware'];
  $range = $_POST["range"];
  $tagtype = $HTTP_POST_VARS["tagtype"];
  $readerrequirements = $HTTP_POST_VARS["readerrequirements"];
  $OtherReaderRequirements = $_POST['OtherReaderRequirements'];
  $PurchaseTimeFrame = $_POST['PurchaseTimeFrame'];
  $Quantities = $_POST['Quantities'];
  $textfield = $_POST['textfield'];
  $ContactName = $_POST['ContactName'];
  $EMailAddress = $_POST['EMailAddress'];

for ($i = 0; $i < sizeof($tagtype); $i++) {
    echo $tagtype[$i];
    echo "<br />";
}

for ($i = 0; $i < sizeof($readerrequirements); $i++) {
    echo $readerrequirements[$i];
    echo "<br />";
}

 
$when = date("D, F d H:i, Y");

$info = $info . "$when\n\n";
$info= $info  . "Application Type: $application\n";
$info = $info . "Application Comments: $applicationOtherComments\n";
$info = $info . "$RequireSoftware\n";
$info = $info . "Range Requirements: $range\n";
$info = $info . "Tag Types: $tagtype\n";
$info = $info . "Reader Requirements:\n $readerrequirements\n";
$info = $info . "Other Requirements:\n  $OtherReaderRequirements\n";
$info = $info . "Purchase Time Frame: $PurchaseTimeFrame\n";
$info = $info . "Approx. Quantities: $Quantities\n";
$info = $info . "Additional Info:\n  $textfield\n";
$info = $info . "Submitted By: $ContactName\n";
$info = $info . "$EMailAddress\n";


$surveyinfo = $surveyinfo ."$info";
$dinfo = $dinfo ."$info";

  mail("emailaddy","RFID Survey Submission: $ContactName",$info,"From: $EMailAddress");

?>


<?
  print "<TABLE BORDER=0 BGCOLOR=\"#FFFFFF\" COLUMNS=5 width=600>\n";
  print "<TR>";
  print "<TH><font face=tahoma size=2 align=left>Thank you $ContactName</TH>\n";
  print "</table></td></tr></table>\n";
?>


Because $tagtype & $readerrequirements have the option of selecting multiple options... I can't get them to appear in my emails as the selections rather than just "Array" as it does now...

Help:)

Jen

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 23 March 2006 - 11:00 PM

If you're mailing this to yourself and you don't care if it isn't formatted like you have it now, the following is the easiest way:
<?php
$info = print_r($_POST,true);
mail("emailaddy",'RFID Survey Submission: ' . $_POST['ContactName'],$info,'From: ' . $_POST['EMailAddress']);
?>
If you care about the formatting:
<?php
$info = ''
$info .= "$when\n\n";
$info .= "Application Type: $application\n";
$info .= "Application Comments: $applicationOtherComments\n";
$info .= "$RequireSoftware\n";
$info .= "Range Requirements: $range\n";
$info .= "Tag Types: $tagtype\n";
$info .= "Reader Requirements:\n $readerrequirements\n";
$info .= "Other Requirements:\n  $OtherReaderRequirements\n";
$info .= "Purchase Time Frame: $PurchaseTimeFrame\n";
$info .= "Approx. Quantities: $Quantities\n";
$info .= "Additional Info:\n  $textfield\n";
$info .= "Submitted By: $ContactName\n";
$info .= "$EMailAddress\n";
$info .= implode(',',$tagtype)."\n";
$info .= implode(',',$readerrequirements)."\n";
mail("emailaddy",'RFID Survey Submission: ' . $_POST['ContactName'],$info,'From: ' . $_POST['EMailAddress']);
?>

Ken


#3 cattledogz

cattledogz
  • Members
  • Pip
  • Newbie
  • 8 posts

Posted 24 March 2006 - 03:29 PM

Hey... Just wanted to say thanks!! That was exactly what I needed!!

Jen




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users