bjneiman Posted February 24, 2009 Share Posted February 24, 2009 I know this is such a simple question...but I'm trying to learn a little bit more about web development after a guy built us a website for our non-profit. Our Contact Us page takes submissions through a web form and emails it to contact@mydomain.org. How do you get the subject line to read: Contact Us - txtname (where txtname is actually the form value that was submitted) I am assuming it is this line that needs changing: @mail($to_email,"Contact Us",$content,$hdr); This and several dozen variations of the same is what did not work: @mail($to_email,"Contact Us + txtname",$content,$hdr); @mail($to_email,"Contact Us" + .$_REQUEST['txtstate'].,$content,$hdr); This is the current page code for submitcontctus.php <? include 'admin/includes/connection.php'; $sqlstr = "insert into cc_contact (contact_name,contact_phone,contact_email,contact_msg) values ('".$_REQUEST["txtname"]."','".$_REQUEST["txtphone"]."','".$_REQUEST["txtemail"]."','".mysql_real_escape_string($_REQUEST["comments"])."')"; //echo $sqlstr;exit; mysql_query($sqlstr); $me="Your Details Successfully Sent"; $to_email='contact@mydomain.org'; $from_email=$_REQUEST["txtemail"]; $hdr = "MIME-Version: 1.0\n"; $hdr .= "From: {$from_email} \n"; $content ="Name : ".$_REQUEST['txtname']."\n"; $content .="State : ".$_REQUEST['txtstate']."\n"; $content .="Email : ".$_REQUEST['txtemail']."\n"; $content .="Message :\n".$_REQUEST['comments']."\n"; [b]@mail($to_email,"Contact Us",$content,$hdr);[/b] header("location: contactus.php?mess=$me"); exit; ?> Quote Link to comment Share on other sites More sharing options...
gevans Posted February 24, 2009 Share Posted February 24, 2009 <? include 'admin/includes/connection.php'; $sqlstr = "insert into cc_contact (contact_name,contact_phone,contact_email,contact_msg) values ('".$_REQUEST["txtname"]."','".$_REQUEST["txtphone"]."','".$_REQUEST["txtemail"]."','".mysql_real_escape_string($_REQUEST["comments"])."')"; //echo $sqlstr;exit; mysql_query($sqlstr); $me="Your Details Successfully Sent"; $to_email='contact@mydomain.org'; $from_email=$_REQUEST["txtemail"]; $hdr = "MIME-Version: 1.0\n"; $hdr .= "From: {$from_email} \n"; $content ="Name : ".$_REQUEST['txtname']."\n"; $content .="State : ".$_REQUEST['txtstate']."\n"; $content .="Email : ".$_REQUEST['txtemail']."\n"; $content .="Message :\n".$_REQUEST['comments']."\n"; $subject = "Contact Us - ".$_REQUEST['txtname']; @mail($to_email,$subject,$content,$hdr); header("location: contactus.php?mess=$me"); exit; ?> That should do it, have a look at the little change I made! Quote Link to comment Share on other sites More sharing options...
bjneiman Posted February 24, 2009 Author Share Posted February 24, 2009 Well lookie there...that seemed to do the trick! I figured I had to define something to make it work. Didn't really know what though! Thanks gevans! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.