Jump to content

Send email to field value code problem


arohamack

Recommended Posts

Hi  :D

FYI I'm a n00b in this particular forum & php n00b really but I'm having a problem & cant find a solution anywhere!

I need to be able to send an email from a form.  Within the form is a dropdown field for different regions.  When a region is selected it sets the email address for that region into an input/text field.  I need to pickup that value and send the email to that address but not sure how.  Have been told to use echo$email & that perhaps my variable is empty but I haven't got a clue where to put it or what that means.  Help please?!

 

my code:

include ('maketable.php'); 
include ('mailbot.php');
include ('auditFile.php');


$office = $_REQUEST["office"];
$callername = $_REQUEST["callername"];
$callerphone = $_REQUEST["callerphone"];
$callaction = $_REQUEST["callaction"];

$callerInfo = "Callers Name=".$callername;
$commentInfo = "Callers Phone No=".$callerphone;
$callDetail = "Action Taken=".$callaction;


$title = "DOC Call Results"; 
$stylesheet = "stylesheet.css"; 
$logo = "tcclogo.jpg"; 
$display = makeHeader($title,$stylesheet,$logo); 
$display .= makeTable("Caller Details",$callerInfo,1);
$display .= makeTable("",$commentInfo,1);
$display .= makeTable("",$callDetail,1);

$display .= '</body></html>';


$info = $callerInfo."; ".$commentInfo."; ".$callDetail;

auditFile($title, $info);
echo $email;
mailbot($title,$display,"email","[email protected]","ThankYou.html");

Link to comment
https://forums.phpfreaks.com/topic/225813-send-email-to-field-value-code-problem/
Share on other sites

    $subject = "Subject";
    $message = "

Thankyou.html

    This is an automated response, please do not reply!";

    mail($email, $subject, $message,
        "From: Name<Youemail>");

 

Maybe try something like that with the $email.

 

 

Thanks Bradley for your quick reply.  I probably should have mentioned that the email is handled from another file called mailbot.php.  The email is working well with no problems, i just really need it to go to the email address that's set in the 'email' field once the region has been selected.

hmmm... I dont think so (?).

 

mailbot.php code:

<?php
function mailbot($title,$display,$recipients,$from,$redirect){

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'FROM:'.$from;

mail($recipients,$title,$display,$headers);
if ($redirect != Null){
    header ("Location: ".$redirect);
}

}

?>

 

Atho in saying that, i've just noticed the $recipients part of it so maybe I need to investigate that a bit more.

:-[

hmmm.... from what I can tell it's definitely NOT the external file that's causing any problems.  I really just need to know where to put the 'echo$email' bit and how in this line...

mailbot($title,$display,"[b]emailfieldvalue as the email address[/b]","[email protected]","ThankYou.html");

I write the field name.

 

Sorry for the bump without really any further information but the guy that normally helps me with this stuff is away and my boss is waiting for some results :(

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.