SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: php form mailer

  1. #1
    SitePoint Member
    Join Date
    Feb 2001
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Getting error messages from my email form.

    New to php but I was able to get my form to reply a thank you message and reply to me via email. But when I was trying to add error checking, that is all I get, errors.

    Reading from PHP fast & easy web development. Below is the part of the script I am having probelms with.

    // Mail content from form
    function mail_it($content, $subject, $email, $recipient) {
    mail($recipient, $subject, $content, "From: $email\r\nReply-To: email\r\nX-Mailer: DT_formmail");
    }

    if ($sender_name == "") {
    $name_err = "<font color=red>Please enter your name.</font><br>";
    $send ="no";
    }
    if ($sender_phone=="") {
    $phone_err = "<font> color=red</font>Please enter a phone number.</font><br>";
    $send = "no";
    }
    if ($sender_email == "") {
    $email_err = "<font> color=red</font>Please enter your e-mail address.</font><br>";
    $send = "no";
    }
    if ($message == "") {
    $message_err = "<font> color=red</font>Please enter a question or message.</font><br>";
    $send "no";
    }
    if ($send != "no") {
    //page will be sent

    The rest of the script works when the above is excluded.

    I would appreciate any help thanks in advance.

    Mike

  2. #2
    imagine no limitations exbabylon's Avatar
    Join Date
    Dec 2000
    Location
    Idaho, USA
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try this:

    PHP Code:
    // Mail content from form 
    function mail_it($content$subject$email$recipient) { 
    mail($recipient$subject$content"From: $email\r\nReply-To: email\r\nX-Mailer: DT_formmail"); 


    if (
    $sender_name == "" or $sender_phone=="" or $sender_email == "" or $message == "" ) { 

    if(
    $sender_name == ""){
    echo 
    "<font color=red>Please enter your name.</font><br>"


    if (
    $sender_phone=="") { 
    echo 
    "<font> color=red</font>Please enter a phone number.</font><br>"

    if (
    $sender_email == "" ) { 
    echo 
    "<font> color=red</font>Please enter your e-mail address.</font><br>"

    if (
    $message == "" ) { 
    echo 
    "<font> color=red</font>Please enter a question or message.</font><br>"


    }
    else {

    mail_it(//blah//);

    Blamestorming: Sitting around in a group discussing why a deadline was missed or a project failed and who was responsible.

    Exbabylon- Professional Internet Services


Bookmarks

Posting Permissions

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