Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Contact Us Form Error
#31
Replace your sc_mail function with this one and let me know what happens.
Code:
function sc_mail () {
    global $successmsg;
    global $sc_captcha;
    global $sc_to;
    $error = 0;
    if( isset($_POST['sc_submitted']) ) {
        $sc_email = $_POST['sc_email'];
        if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$sc_email )){
            $successmsg = "<div style=\"color:red; text-align:center;\">Invalid email address entered.</div>";
            $error = 1;
        }
        if ( empty($_POST['sc_name']) || empty($_POST['sc_email']) || empty($_POST['sc_subject']) || empty($_POST['sc_message'])) {
            $successmsg = "<div style=\"color:red; text-align:center;\">Please fill out all fields.</div>";
            $error = 1;
        }
        if ($_POST['sc_captcha'] != $sc_captcha) {
            $successmsg = "<div style=\"color:red; text-align:center;\">Captcha answer incorrect.</div>";
            $error = 1;            
        }
        if ($error != 1){
            $from = $_POST['sc_email'];
            $headers="Content-Type: text/plain; charset=UTF-8\r\n";
            $headers.= "From: $from \n";
            $message = "Name: ".$_POST['sc_name'];
            $message = $message."\n". "E-mail: ".$_POST['sc_email'];
            $message = $message."\n". "Message: ".$_POST['sc_message'];
            mail($sc_to, $_POST['sc_subject'], $message, $headers);
            $successmsg = "<div style=\"color:red; text-align:center;\">Thank you... The form was successfully sent.</div>";
            //Clear values
            $_POST = array();
        }
    } else {
        $successmsg = "";
    }
}
Clients always want to be able to change the content of their pages, but they are unwilling to do so.

Have you ever coded in your underwear before?
Reply


Messages In This Thread
Contact Us Form Error - by crashfellow - 2010-03-04, 23:25:10
Contact Us Form Error - by internet54 - 2010-03-05, 01:40:09
Contact Us Form Error - by Zegnåt - 2010-03-05, 08:40:42
Contact Us Form Error - by crashfellow - 2010-03-05, 09:25:05
Contact Us Form Error - by internet54 - 2010-03-05, 11:16:08
Contact Us Form Error - by ccagle8 - 2010-03-05, 12:22:08
Contact Us Form Error - by crashfellow - 2010-03-05, 12:54:57
Contact Us Form Error - by crashfellow - 2010-03-05, 13:00:05
Contact Us Form Error - by crashfellow - 2010-03-05, 13:19:23
Contact Us Form Error - by internet54 - 2010-03-05, 15:12:39
Contact Us Form Error - by crashfellow - 2010-03-05, 15:16:54
Contact Us Form Error - by crashfellow - 2010-03-05, 15:18:03
Contact Us Form Error - by Zegnåt - 2010-03-05, 19:37:52
Contact Us Form Error - by crashfellow - 2010-03-05, 21:17:14
Contact Us Form Error - by internet54 - 2010-03-06, 01:31:10
Contact Us Form Error - by crashfellow - 2010-03-06, 08:47:48
Contact Us Form Error - by internet54 - 2010-03-06, 08:56:07
Contact Us Form Error - by crashfellow - 2010-03-06, 09:38:55
Contact Us Form Error - by FredK - 2010-03-09, 09:10:07
Contact Us Form Error - by internet54 - 2010-03-09, 16:59:18
Contact Us Form Error - by thkro - 2010-03-09, 20:35:39
Contact Us Form Error - by Zegnåt - 2010-03-09, 23:41:36
Contact Us Form Error - by thkro - 2010-03-09, 23:53:13
Contact Us Form Error - by Zegnåt - 2010-03-09, 23:55:54
Contact Us Form Error - by thkro - 2010-03-10, 00:36:06
Contact Us Form Error - by internet54 - 2010-03-10, 02:19:26
Contact Us Form Error - by internet54 - 2010-03-10, 06:12:49
Contact Us Form Error - by Alex - 2010-03-12, 02:38:22
Contact Us Form Error - by internet54 - 2010-03-12, 03:08:51
Contact Us Form Error - by Alex - 2010-03-12, 07:33:14
Contact Us Form Error - by internet54 - 2010-03-12, 10:05:24
Contact Us Form Error - by Alex - 2010-03-12, 20:40:17
Contact Us Form Error - by internet54 - 2010-03-13, 01:43:03



Users browsing this thread: 1 Guest(s)