Does anyone here know where to get a good PHP Formmail script. I’ve heard so many horror stories using CGI Formmail. I don’t know a lick of PHP, so any help would be appreciated.
Thanks Dave
s a simple PHP contact form on my site if you want to try it. If you don
[code=php] <?php ### simple form handler to send email ### # set email address in following variables # address will be concatenated as "$name@$location" $name = "yourname"; $location = "yahoo.com"; $msg = ""; # body of email message # parse the _POST or _GET array, depending which form method was used: if(count($_POST) >= 1) { foreach($_POST as $key=>$value) { $msg .= "$key: $valuen"; } } elseif(count($_GET) >= 1) { foreach($_GET as $key=>$value) { $msg .= "$key: $valuen"; } } if($msg == "") { $result = "ERROR: No form data received."; } else # send the email { $address = "$name@$location"; $subject = "Web form submission"; $rc = mail($address, $subject, $msg, "From: $addressrnReply-To: $address"); $result = $rc ? "SUCCESS: Form has been emailed." : "ERROR: Email of form data failed."; } # display the results: echo <<<EOD <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang='en'><head><title>Form Mail Handler</title> <META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=ISO-8859-1'> <style type="text/css"> body { background: white; margin: 0; padding: 2em; font: medium/1.3em normal arial, sans-serif; } </style> </head> <body> <h1>Form Email Results</h1> <p>$result</p> </body> </html> EOD; ?> [/code]
Help @djob66 spread the word by sharing this article on Twitter...