Jump to content

Recommended Posts

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:

[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";
?>
[/code]


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
Link to comment
https://forums.phpfreaks.com/topic/5631-form-arrays-mail-functions/
Share on other sites

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:
[code]<?php
$info = print_r($_POST,true);
mail("emailaddy",'RFID Survey Submission: ' . $_POST['ContactName'],$info,'From: ' . $_POST['EMailAddress']);
?>[/code]
If you care about the formatting:
[code]<?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']);
?>[/code]

Ken
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.