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","info@tcc.co.nz","ThankYou.html");

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

:-[

Link to comment
Share on other sites

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]","info@tcc.co.nz","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 :(

Link to comment
Share on other sites

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.