Joining fixed text to a SUBJECT variable
| From: | Michael CALDER | Date: | Sat, 02 Mar 2013 11:04:38 +0000 |
| Subject: | Joining fixed text to a SUBJECT variable | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-320352@lists.php.net to get a copy of this message | ||
-- G'day ,
I have a basically simple problem the solution to which has eluded me
for several days.
I have a form being handled by a .php file.
I want the received email sent by the form to have as its SUBJECT the
combination of the form name "RVRA Contact Form - " and the MESSAGE
SUBJECT as chosen in the form drop down box.
Here is the current contact2.php file - but the SUBJECT only shows as
RVRA Contact Form -
<?php
// get posted data into local variables
$EmailAddress = Trim(stripslashes($_POST['EmailAddress']));
$EmailTo = "mikecalder@optusnet.com.au";
$Subject = "RVRA Contact Form - ,$MessageSubject";
$Name = Trim(stripslashes($_POST['Name']));
$EmailAddress = Trim(stripslashes($_POST['EmailAddress']));
$YesNo = Trim(stripslashes($_POST['YesNo']));
$MessageSubject = Trim(stripslashes($_POST['MessageSubject']));
$Message = Trim(stripslashes($_POST['Message']));
// send email
if(!isset($_REQUEST['identiPIC_selected'])){exit;}
$identiPIC[1] = "Bird";
$identiPIC[2] = "Logo";
$identiPIC[3] = "Flower";
if($_REQUEST['identiPIC_selected'] !== $identiPIC){print "<meta
http-equiv=\"refresh\" content=\"0;URL=error-pic.html\">"; exit;}
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "EmailAddress: ";
$Body .= $EmailAddress;
$Body .= "\n";
$Body .= "RVRA Member";
$Body .= $YesNo;
$Body .= "\n";
$Body .= "Message Subject: ";
$Body .= $MessageSubject;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailAddress>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=thanks.html\">";} else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error-pic.html\">";} ?> The critical line is line 4: $Subject = "RVRA Contact Form - ,$MessageSubject"; Can anyone please advise or point me in the right direction for instructions on how to combine the fixed text with the variable $MessageSubject. Thanks.... Mike Michael CALDER 73/81 Willandra Road, CROMER NSW 2099 02 9981 6327