codieB Posted December 10, 2008 Share Posted December 10, 2008 Hi, This is what I've got---- $Name = "name"; //senders name $email = "name@name.com"; //senders e-mail adress $recipient = $_REQUEST['email']; //recipient $reply = "Congratulations! Video access for " .$_POST['fname']." ".$_POST['lname'].""; $mail_body = "content""; All of it is working EXCEPT the reply part. It should be pulling fname and lname rom input fields. Does anyone know what to do? Quote Link to comment Share on other sites More sharing options...
premiso Posted December 10, 2008 Share Posted December 10, 2008 Post the actual form and please use the [ code ] [ /code ] tags to post your code in (note remove the extra spaces in the code tags) Quote Link to comment Share on other sites More sharing options...
codieB Posted December 10, 2008 Author Share Posted December 10, 2008 How do you do that? This is my first time on site. Quote Link to comment Share on other sites More sharing options...
gevans Posted December 10, 2008 Share Posted December 10, 2008 Do you have the form for us to see? Quote Link to comment Share on other sites More sharing options...
codieB Posted December 10, 2008 Author Share Posted December 10, 2008 Where do I put form for you to see it? Quote Link to comment Share on other sites More sharing options...
premiso Posted December 10, 2008 Share Posted December 10, 2008 [ code] Post code here. [ /code] But since I cannot show you the actual tag, remove the first space before code and /code. Then just paste your form. Quote Link to comment Share on other sites More sharing options...
codieB Posted December 10, 2008 Author Share Posted December 10, 2008 Is this what you need? <?php function spamcheck($field) { //filter_var() sanitizes the e-mail //address using FILTER_SANITIZE_EMAIL $field=filter_var($field, FILTER_SANITIZE_EMAIL); //filter_var() validates the e-mail //address using FILTER_VALIDATE_EMAIL if(filter_var($field, FILTER_VALIDATE_EMAIL)) { return TRUE; } else { return FALSE; } } if (isset($_REQUEST['email'])) {//if "email" is filled out, proceed //check if the email address is invalid $mailcheck = spamcheck($_REQUEST['email']); if ($mailcheck==FALSE) { echo "Invalid input"; } else {//send email $Name = "name"; //senders name $email = "name@name.com"; //senders e-mail adress $recipient = $_REQUEST['email']; //recipient $reply = "Congratulations! Video access for " .$_POST['fname']." ".$_POST['lname'].""; $mail_body = "content "; //mail body $subject = "Video Access"; //subject $headers = "From: ". $Name . " <" . $email . ">\r\nbcc: susiem@multiprobe.com\r\n"; //optional headerfields $headers .= "BCC: name2@name2.com\r\n"; mail($recipient, $subject, $mail_body, $reply, $headers); //mail command echo "<font size='3'><font color='#c61317'><strong>Thank you.</font></strong> Please check your email for the access link.</font>"; } } else {//if "email" is not filled out, display the form echo "<form method='post' action='videoAccess.php'> First Name: <input name='fname' type='text' /><br /> Last Name: <input name='lname' type='text' /><br /> Email: <input name='email' type='text' /><br /><br /> Subject: <strong>Subject</strong><br /><br /> <input type='submit' /> </form>"; } ?> Quote Link to comment Share on other sites More sharing options...
gevans Posted December 10, 2008 Share Posted December 10, 2008 Have you looked at the mail() function? The third argument it takes is additional headers. I think what you want is this; mail($recipient, $subject, $mail_body."\n\n".$reply, $headers); //mail command Quote Link to comment Share on other sites More sharing options...
codieB Posted December 10, 2008 Author Share Posted December 10, 2008 Hi Supporter, That doesn't seem to work either. Quote Link to comment Share on other sites More sharing options...
Maq Posted December 10, 2008 Share Posted December 10, 2008 He meant this! [ code] (no spaces) function spamcheck($field) { //filter_var() sanitizes the e-mail //address using FILTER_SANITIZE_EMAIL $field=filter_var($field, FILTER_SANITIZE_EMAIL); //filter_var() validates the e-mail //address using FILTER_VALIDATE_EMAIL if(filter_var($field, FILTER_VALIDATE_EMAIL)) { return TRUE; } else { return FALSE; } } if (isset($_REQUEST['email'])) {//if "email" is filled out, proceed //check if the email address is invalid $mailcheck = spamcheck($_REQUEST['email']); if ($mailcheck==FALSE) { echo "Invalid input"; } else {//send email $Name = "name"; //senders name $email = "name@name.com"; //senders e-mail adress $recipient = $_REQUEST['email']; //recipient $reply = "Congratulations! Video access for " .$_POST['fname']." ".$_POST['lname'].""; $mail_body = "content "; //mail body $subject = "Video Access"; //subject $headers = "From: ". $Name . " \r\nbcc: susiem@multiprobe.com\r\n"; //optional headerfields $headers .= "BCC: name2@name2.com\r\n"; mail($recipient, $subject, $mail_body, $reply, $headers); //mail command echo "Thank you. Please check your email for the access link."; } } else {//if "email" is not filled out, display the form echo "</pre> <form method="'post'" action="'videoAccess.php'"> First Name: Last Name: Email: Subject: Subject </form>";<br> }<br [ /code] (no spaces) Look at all the pretty colors... Quote Link to comment Share on other sites More sharing options...
gevans Posted December 10, 2008 Share Posted December 10, 2008 Hi Supporter, That doesn't seem to work either. A little more information would be nice, i.e. what error do you get? Quote Link to comment Share on other sites More sharing options...
codieB Posted December 10, 2008 Author Share Posted December 10, 2008 Hi Supportr, NO ERROR message. I just don't get the fname and lname included in the reply. I get everything else though. ???? Quote Link to comment Share on other sites More sharing options...
gevans Posted December 10, 2008 Share Posted December 10, 2008 Can you post the text that you do get? (just to help me out ) Quote Link to comment Share on other sites More sharing options...
codieB Posted December 10, 2008 Author Share Posted December 10, 2008 What this code does is send an automatic email to the email that is indicated in the form field. I also included fname and lname fields that are being pulled to personalize the email. So, without divulging entire contents of email, the recipient gets and email that offers a link to a video archive, and BCC's me at the same time. That way, I can see who is accessing the archive. In order to also get their names, I would like the emails to begin with "Dear ," or something to that affect. Does this help? Quote Link to comment Share on other sites More sharing options...
codieB Posted December 10, 2008 Author Share Posted December 10, 2008 Is this better? nospaces <?php function spamcheck($field) { //filter_var() sanitizes the e-mail //address using FILTER_SANITIZE_EMAIL $field=filter_var($field, FILTER_SANITIZE_EMAIL); //filter_var() validates the e-mail //address using FILTER_VALIDATE_EMAIL if(filter_var($field, FILTER_VALIDATE_EMAIL)) { return TRUE; } else { return FALSE; } } if (isset($_REQUEST['email'])) {//if "email" is filled out, proceed //check if the email address is invalid $mailcheck = spamcheck($_REQUEST['email']); if ($mailcheck==FALSE) { echo "Invalid input"; } else {//send email $Name = "name"; //senders name $email = "name@name.com"; //senders e-mail adress $recipient = $_REQUEST['email']; //recipient $reply = "Congratulations! Video access for " .$_POST['fname']." ".$_POST['lname'].""; $mail_body = "content "; //mail body $subject = "Video Access"; //subject $headers = "From: ". $Name . " <" . $email . ">\r\nbcc: susiem@multiprobe.com\r\n"; //optional headerfields $headers .= "BCC: name2@name2.com\r\n"; mail($recipient, $subject, $mail_body, $reply, $headers); //mail command echo "<font size='3'><font color='#c61317'><strong>Thank you.</font></strong> Please check your email for the access link.</font>"; } } else {//if "email" is not filled out, display the form echo "<form method='post' action='videoAccess.php'> First Name: <input name='fname' type='text' /><br /> Last Name: <input name='lname' type='text' /><br /> Email: <input name='email' type='text' /><br /><br /> Subject: <strong>Subject</strong><br /><br /> <input type='submit' /> </form>"; } ?> [/code}no spaces Quote Link to comment Share on other sites More sharing options...
Maq Posted December 10, 2008 Share Posted December 10, 2008 1) Why do you use REQUEST for some fields and POST for others? You should stay consistent. 2) Echo out your POSTS (fname, lname); 3) Add this at the top of your script, right after the first <?php tag ini_set ("display_errors", "1"); error_reporting(E_ALL); Quote Link to comment Share on other sites More sharing options...
codieB Posted December 10, 2008 Author Share Posted December 10, 2008 Maq, Will consistency help this work? Also, what does the code you sent do-----? ini_set ("display_errors", "1"); error_reporting(E_ALL); Quote Link to comment Share on other sites More sharing options...
jnerotrix Posted December 10, 2008 Share Posted December 10, 2008 ini_set ("display_errors", "1"); error_reporting(E_ALL); This code makes your page display all errors that go on in your website just use copy and paste this <?php ini_set ("display_errors", "1"); error_reporting(E_ALL); function spamcheck($field) { //filter_var() sanitizes the e-mail //address using FILTER_SANITIZE_EMAIL $field=filter_var($field, FILTER_SANITIZE_EMAIL); //filter_var() validates the e-mail //address using FILTER_VALIDATE_EMAIL if(filter_var($field, FILTER_VALIDATE_EMAIL)) { return TRUE; } else { return FALSE; } } if (isset($_REQUEST['email'])) {//if "email" is filled out, proceed //check if the email address is invalid $mailcheck = spamcheck($_REQUEST['email']); if ($mailcheck==FALSE) { echo "Invalid input"; } else {//send email $Name = "name"; //senders name $email = "name@name.com"; //senders e-mail adress $recipient = $_REQUEST['email']; //recipient $reply = "Congratulations! Video access for " .$_POST['fname']." ".$_POST['lname'].""; $mail_body = "content "; //mail body $subject = "Video Access"; //subject $headers = "From: ". $Name . " <" . $email . ">\r\nbcc: susiem@multiprobe.com\r\n"; //optional headerfields $headers .= "BCC: name2@name2.com\r\n"; mail($recipient, $subject, $mail_body, $reply, $headers); //mail command echo "<font size='3'><font color='#c61317'><strong>Thank you.</font></strong> Please check your email for the access link.</font>"; } } else {//if "email" is not filled out, display the form echo "<form method='post' action='videoAccess.php'> First Name: <input name='fname' type='text' /><br /> Last Name: <input name='lname' type='text' /><br /> Email: <input name='email' type='text' /><br /><br /> Subject: <strong>Subject</strong><br /><br /> <input type='submit' /> </form>"; } ?> Quote Link to comment Share on other sites More sharing options...
codieB Posted December 10, 2008 Author Share Posted December 10, 2008 Maq, I'm sorry---I hate to be slow here, but HOW does it display the errors? What identifies the errors? Do you have a solution to the reply problem or know how to include "Dear " in the automatic reply email? Quote Link to comment Share on other sites More sharing options...
jnerotrix Posted December 10, 2008 Share Posted December 10, 2008 That code tells php display any errors in the code no matter what the error is it just displays it Quote Link to comment Share on other sites More sharing options...
codieB Posted December 10, 2008 Author Share Posted December 10, 2008 Does anyone know how to include the recipients name in the reply email? I really need help with this. Everything else seems to work just fine. Thanks. Quote Link to comment Share on other sites More sharing options...
codieB Posted December 10, 2008 Author Share Posted December 10, 2008 Guess this one's a doozy! Quote Link to comment Share on other sites More sharing options...
jnerotrix Posted December 10, 2008 Share Posted December 10, 2008 try replacing $reply = "Congratulations! Video access for " .$_POST['fname']." ".$_POST['lname'].""; with this $reply = "Congratulations! Video access for ' . $_POST['fname']. ' ' . $_POST['lname'] . '"; Quote Link to comment Share on other sites More sharing options...
jnerotrix Posted December 10, 2008 Share Posted December 10, 2008 try replacing $reply = "Congratulations! Video access for " .$_POST['fname']." ".$_POST['lname'].""; with this $reply = "Congratulations! Video access for ' . $_POST['fname'] . ' ' . $_POST['lname'] . '"; I EDITED IT SORRY NOW TRY IT Quote Link to comment Share on other sites More sharing options...
codieB Posted December 10, 2008 Author Share Posted December 10, 2008 That gave this error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING on line 77 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.