www.webdeveloper.com
Results 1 to 4 of 4

Thread: PHP Mail() and form question for noob

  1. #1
    Join Date
    Sep 2008
    Posts
    5

    PHP Mail() and form question for noob

    I have a script which collects information entered into a javascript, processes it with php and simultaneously emails the desired party all the information with a pdf of the info. This all works fine. What I would like the script to do in addition is email the desired party the form information (already done), while in the same script , it could email the form-filler only a thank you message that confirms that their form has been received. If I'm not mistaken it should be really simple. I will post what I think is the relevant php code:

    PHP code for the pdf:
    ...
    $m = new Mail(); // create the mail
    $m->From( "admin@...org" );

    $m->To( "recipient1@...org");
    $m->Cc( $email);
    $m->Bcc( "recipient2@...org");


    $m->Subject( $status . " - " . $first_name . " " . $last_name );
    $m->Body( "Application\n");

    $m->Priority(3);
    $m->Attach( $filename, "application/x-adobe", "attachment" );
    $m->Send();

    ?>
    </head>
    ...

  2. #2
    Join Date
    Sep 2008
    Posts
    5

    Any ideas please?

    Hmm. Does anyone have any ideas please? I've searched around the forum and haven't found anything to help with this.

  3. #3
    Join Date
    Sep 2008
    Posts
    5

    Some more of the php code and some of the javascript

    PHP Code:
    if ($status=="Student") {
        
    $status_info "Major: " $student_major "\n" "Graduation Year: " $student_grad_year "\n" "Degree: " $student_degree "\n";
        }
    if (
    $status=="Faculty") {
        
    $status_info "Department: " $fs_department "\n" ;
        } 

    Here is some of the javascript:
    Code:
    <script type="text/javascript">
    
    function isEmail(who) {
    var email2=/^.+@.+\..{2,3}$/;
        with (who)
        {
            if (!email2.test(who)) {
            alert("Please enter correct email address"); return false}
            else { return true}
        }
    }
    
    function validate_required(field,alerttxt)
    {
    with (field)
    {
    if (value==null||value=="")
      {alert(alerttxt);return false}
    else {return true}
    }
    }
    
    function validate_form(thisform)
    {
    with (thisform)
    {   
    
        if (validate_required(first_name,"Please include your first name!")==false)
              {first_name.focus();return false}
        if (validate_required(last_name,"Please include your last name!")==false)
              {last_name.focus();return false}   
        if (validate_required(phone,"Please include your phone number!")==false)
              {phone.focus();return false}   
        if (validate_required(email,"Please include your email!")==false)
              {email.focus();return false}
        <!--if (!isEmail(email))        {email.focus();return false}-->
            if (validate_required(venture_name,"Please include the name of your venture!")==false)
              {venture_name.focus();return false}

  4. #4
    Join Date
    Apr 2007
    Posts
    1,664
    You question is a little unclear. But can't you just concatenate the POST info to the body?
    eg
    $m->Body( "Application\n".$_POST['field_one']);

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles