Menu

Sending copy to originator

Help
2005-12-20
2013-06-03
  • SyntheticShield

    SyntheticShield - 2005-12-20

    Can the form be coded to send the filled out form to not only myself but to the person that filled out the form using the email address they input?

    I realize not everyone would use the email field, but does anyone have a code example I could add in so this could be done?  I saw one post on the help section that asked this but was directed elsewhere and I never found any further info.  Id also like to add in a subject line as well if possible.

    Now having asked that I want to say this.  What an AWSOME package.  I have looked and looked for a PHP form builder and was contemplating how much I was going to have to spend.  I even bought some self-teaching books on PHP so I could hopefully at some point make my own.  Then I ran across phpFormGenerator.  First, the program is free, I was floored at that and that it was so functional.  Secondly, the support.  When I saw the forums I quite honestly expected to see a bunch of unanswered threads.  How wrong could I have possibly been!  Not only is it free but there is awsome support here.  Kudo's to all involved.  I hope version 3 comes out soon I would love to see what it can do.

     
    • TNTEverett

      TNTEverett - 2005-12-20

      Simple change to the process.php file.
      This is similar to what you have:
      //Variables from the form put into a message string to send via the mail() function.
      $message="FirstName: ".$FirstName."
      LastName: ".$LastName."
      Email: ".$Email."
      ";
      //Strip slashes from the message string.
      $message = stripslashes($message);
      //Send the mail using the mail() function.
      mail("youremail@yourdomain","Form Submitted at your website",$message,"From: phpFormGenerator");

      You can modify your process.php to do anything you desire. 

      //Notes from the PHP.net documentation:
      //Mail Function Syntax Description
      //bool mail ( string to, string subject, string message [, string additional_headers [, string additional_parameters]] )

      So here is what you can do to modify the process.php mail() function:
      //Notes from the PHP.net documentation:
      //Send to multiple recipients using the $to variable.
      $to  = 'youremail@yourdomain' . ', '; // note the comma
      $to .= $Email; //Variable from your form
      //Set a subject
      $subject = 'Birthday Reminders for August'; //Could be $Subject from your form, as is done with $Email
      //Set the header to specify where the email is from.
      $headers  = 'From: birthday@example.com'
      // Mail it (replaces the original mail() function)
      mail($to, $subject, $message, $headers);

      These changes allow you to send to multiple emails, set the subject (fixed or dynamic), set the from.  I may have missed some detail in the syntax but you get the idea.  If you need any help you can contact me anytime. 

      More examples can be found here:
      http://us2.php.net/function.mail

       
    • SyntheticShield

      SyntheticShield - 2005-12-20

      Hey TNTEverett, thanks for the reply.  I'll try and get it going from what you've showed me here so far.  If I run into any trouble I'll probably get in touch with you then but I would like to try it and work out any bugs myself first, best way to learn I have found yet.

      Thanks for the help.

       
    • pendulum_master

      pendulum_master - 2006-08-01

      I am also having a problem trying to have an auto response sent to the person filling out the form.
      Can someone explain to me what exactly I need to change in my process file to get this done? I would really appreciate it.

      My process.php looks like this:

      <?php
      include("global.inc.php");
      $errors=0;
      $error="The following errors occured while processing your form input.<ul>";
      pt_register('POST','Name');
      pt_register('POST','Email');
      pt_register('POST','Location');
      pt_register('POST','Age');
      pt_register('POST','CommentsorSuggestions');
      $CommentsorSuggestions=preg_replace("/(\015\012)|(\015)|(\012)/","&nbsp;<br />", $CommentsorSuggestions);pt_register('POST','Wouldyoulikeustocontactyou');
      if($Email=="" || $Location=="" || $Age=="" || $Wouldyoulikeustocontactyou=="" ){
      $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="Name: ".$Name."
      Email: ".$Email."
      Location: ".$Location."
      Age: ".$Age."
      Comments or Suggestions: ".$CommentsorSuggestions."
      Would you like us to contact you: ".$Wouldyoulikeustocontactyou."
      ";
      $message = stripslashes($message);
      mail("me@domain.com","Form Submitted at your website",$message,"From: phpFormGenerator");
      ?>

       
      • TNTEverett

        TNTEverett - 2006-08-01

        Your answer is in my response to the original post.  Try this link, or click on the RE: next to my name above (tnteveret1).
        https://sourceforge.net/forum/message.php?msg_id=3486098

         
    • SteveMcc1452

      SteveMcc1452 - 2006-09-19

      Hi. I'm new to this site but I like what I see so far. My question is this: Is there a way to create a form asking for the user's email address and a file name and then have that file emailed as an attachment to the address they entered?

       
      • TNTEverett

        TNTEverett - 2006-09-19

        Possible, but not a standard feature. 

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.