kemper Posted May 4, 2007 Share Posted May 4, 2007 How can I add reply to fuction to my script? I would like to automatically send a response to submitter with form contents plus a simple message. My code is: <?php include("global.inc.php"); $errors=0; $error="The following errors occured while processing your form input.<ul>"; pt_register('POST','Club'); pt_register('POST','OtherClub'); pt_register('POST','Team'); pt_register('POST','Age'); pt_register('POST','Division'); pt_register('POST','League'); pt_register('POST','Division0607'); pt_register('POST','Wins'); pt_register('POST','Losses'); pt_register('POST','Ties'); pt_register('POST','Place'); pt_register('POST','Tournaments0607'); pt_register('POST','Coach'); pt_register('POST','CoachAddress'); pt_register('POST','CoachCity'); pt_register('POST','CoachZip'); pt_register('POST','CoachPhone'); pt_register('POST','Coachemail'); pt_register('POST','Manager'); pt_register('POST','ManagerAddress'); pt_register('POST','ManagerCity'); pt_register('POST','ManagerZip'); pt_register('POST','ManagerPhone'); pt_register('POST','Manageremail'); pt_register('POST','Field'); pt_register('POST','Scheduler'); pt_register('POST','SchedulerPhone'); pt_register('POST','Scheduleremail'); pt_register('POST','Assignor'); pt_register('POST','AssignorPhone'); pt_register('POST','Assignoremail'); pt_register('POST','District'); pt_register('POST','Registrar'); pt_register('POST','Sept8'); pt_register('POST','Sept9'); pt_register('POST','Sept15'); pt_register('POST','Sept16'); pt_register('POST','Sept22'); pt_register('POST','Sept23'); pt_register('POST','Sept29'); pt_register('POST','Sept30'); pt_register('POST','Oct6'); pt_register('POST','Oct7'); pt_register('POST','Oct13'); pt_register('POST','Oct14'); pt_register('POST','Oct20'); pt_register('POST','Oct21'); pt_register('POST','Oct27'); pt_register('POST','Oct28'); pt_register('POST','Rules'); pt_register('POST','Signed'); pt_register('POST','Duties'); pt_register('POST','ContactPhone'); pt_register('POST','email'); if($Club=="" || $Team=="" || $Age=="" || $Division=="" || $Rules=="" || $Signed=="" || $Duties=="" || $ContactPhone=="" || $email=="" ){ $errors=1; $error.="<li>You did not enter one or more of the required fields. Please go back and try again."; } if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email)){ $error.="<li>Invalid email address entered"; $errors=1; } if($errors==1) echo $error; else{ $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/")); $message="Club: ".$Club." Other Club: ".$OtherClub." Team: ".$Team." Age: ".$Age." Division: ".$Division." League: ".$League." Division 06/07: ".$Division0607." Wins: ".$Wins." Losses: ".$Losses." Ties: ".$Ties." Place: ".$Place." Tournaments 06/07: ".$Tournaments0607." Coach: ".$Coach." Coach Address: ".$CoachAddress." Coach City: ".$CoachCity." Coach Zip: ".$CoachZip." Coach Phone: ".$CoachPhone." Coach email: ".$Coachemail." Manager: ".$Manager." Manager Address: ".$ManagerAddress." Manager City: ".$ManagerCity." Manager Zip: ".$ManagerZip." Manager Phone: ".$ManagerPhone." Manager email: ".$Manageremail." Field: ".$Field." Scheduler: ".$Scheduler." Scheduler Phone: ".$SchedulerPhone." Scheduler email: ".$Scheduleremail." Assignor: ".$Assignor." Assignor Phone: ".$AssignorPhone." Assignor email: ".$Assignoremail." District: ".$District." Registrar: ".$Registrar." September 8: ".$Sept8." September 9: ".$Sept9." September 15: ".$Sept15." September 16: ".$Sept16." September 22: ".$Sept22." September 23: ".$Sept23." September 29: ".$Sept29." September 30: ".$Sept30." October 6: ".$Oct6." October 7: ".$Oct7." October 13: ".$Oct13." October 14: ".$Oct14." October 20: ".$Oct20." October 21: ".$Oct21." October 27: ".$Oct27." October 28: ".$Oct28." Rules: ".$Rules." Signed: ".$Signed." Duties: ".$Duties." Contact Phone: ".$ContactPhone." email: ".$email." "; $message = stripslashes($message); mail("***@***.org","Fall 2007 Registration",$message,"From: $email"); $link = mysql_connect("***","***","***"); mysql_select_db("***",$link); $query="insert into f2007_registrations (Club,Other_Club,Team,Age,Division,League,Division_0607,Wins,Losses,Ties,Place,Tournaments_0607,Coach,Coach_Address,Coach_City,Coach_Zip,Coach_Phone,Coach_email,Manager,Manager_Address,Manager_City,Manager_Zip,Manager_Phone,Manager_email,Field,Scheduler,Scheduler_Phone,Scheduler_email,Assignor,Assignor_Phone,Assignor_email,District,Registrar,Sept8,Sept9,Sept15,Sept16,Sept22,Sept23,Sept29,Sept30,Oct6,Oct7,Oct13,Oct14,Oct20,Oct21,Oct27,Oct28,Rules,Signed,Duties,Contact_Phone,email) values ('".$Club."','".$OtherClub."','".$Team."','".$Age."','".$Division."','".$League."','".$Division0607."','".$Wins."','".$Losses."','".$Ties."','".$Place."','".$Tournaments0607."','".$Coach."','".$CoachAddress."','".$CoachCity."','".$CoachZip."','".$CoachPhone."','".$Coachemail."','".$Manager."','".$ManagerAddress."','".$ManagerCity."','".$ManagerZip."','".$ManagerPhone."','".$Manageremail."','".$Field."','".$Scheduler."','".$SchedulerPhone."','".$Scheduleremail."','".$Assignor."','".$AssignorPhone."','".$Assignoremail."','".$District."','".$Registrar."','".$Sept8."','".$Sept9."','".$Sept15."','".$Sept16."','".$Sept22."','".$Sept23."','".$Sept29."','".$Sept30."','".$Oct6."','".$Oct7."','".$Oct13."','".$Oct14."','".$Oct20."','".$Oct21."','".$Oct27."','".$Oct28."','".$Rules."','".$Signed."','".$Duties."','".$ContactPhone."','".$email."')"; mysql_query($query); header("Refresh: 0;url=http://www.*******.org/viewpage.php?page_id=46"); ?><?php } ?> Quote Link to comment https://forums.phpfreaks.com/topic/49934-solved-form-process-adding-reply-to-function/ Share on other sites More sharing options...
clown[NOR] Posted May 4, 2007 Share Posted May 4, 2007 i'm not sure I follow you... but I do belive I see something that's wrong here shouldn't it be header("Location: http://www.*******.org/viewpage.php?page_id=46"); please correct me if i'm wrong Quote Link to comment https://forums.phpfreaks.com/topic/49934-solved-form-process-adding-reply-to-function/#findComment-245089 Share on other sites More sharing options...
kemper Posted May 4, 2007 Author Share Posted May 4, 2007 Yes, it is. Thank you for the correction. Along with the email to my specified email account, I would like a reply email send to the person completing the form, like a confirmation of the submission. Can this be done? Quote Link to comment https://forums.phpfreaks.com/topic/49934-solved-form-process-adding-reply-to-function/#findComment-245093 Share on other sites More sharing options...
clown[NOR] Posted May 4, 2007 Share Posted May 4, 2007 make one $admin_body and one $user_body ... then you send the $admin_body to yourself, and $user_body to the person that registered... did i understand the problem right? Quote Link to comment https://forums.phpfreaks.com/topic/49934-solved-form-process-adding-reply-to-function/#findComment-245103 Share on other sites More sharing options...
kemper Posted May 4, 2007 Author Share Posted May 4, 2007 isn't mail("***@***.org","Fall 2007 Registration",$message,"From: $email"); the mail to me (my specified email account) code? Don't I need something similar for "reply to"? I wrote it that way in .cgi but that scripting is so old and not database compatible. Quote Link to comment https://forums.phpfreaks.com/topic/49934-solved-form-process-adding-reply-to-function/#findComment-245106 Share on other sites More sharing options...
trq Posted May 4, 2007 Share Posted May 4, 2007 $to = '***@***.org'; $subject = 'Fall 2007 Registration'; $message = stripslashes($message); $headers = "From: webmaster@foo.com\r\nReply-To: webmaster@foo.com\r\n"; mail($to,$subject,$message,$headers); Is this what you mean? Quote Link to comment https://forums.phpfreaks.com/topic/49934-solved-form-process-adding-reply-to-function/#findComment-245112 Share on other sites More sharing options...
kemper Posted May 4, 2007 Author Share Posted May 4, 2007 Not a reply to as my alternative to me email. Along with the email to my specified email account, I would like a reply email send to the person completing the form, like a confirmation of the submission. Quote Link to comment https://forums.phpfreaks.com/topic/49934-solved-form-process-adding-reply-to-function/#findComment-245115 Share on other sites More sharing options...
trq Posted May 4, 2007 Share Posted May 4, 2007 Ah well, the to field can contain multiple addresses. $to = '***@***.org, foo@bar.com'; You might try the man for more details. Quote Link to comment https://forums.phpfreaks.com/topic/49934-solved-form-process-adding-reply-to-function/#findComment-245117 Share on other sites More sharing options...
clown[NOR] Posted May 4, 2007 Share Posted May 4, 2007 what I ment was more like $admin_body = "This user has registered on the website"; $user_body = "Thanks for creating an account on our website, blablabla"; mail($yourmail, "New user", $admin_body); mail($usermail, "Thank you", $user_body); something down those lines... think it's possible... Quote Link to comment https://forums.phpfreaks.com/topic/49934-solved-form-process-adding-reply-to-function/#findComment-245122 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.