PHP Help! I Can't Get This Damn E-mail Form To Work?
-
Ok, i'm trying to make an e-mail form for www.kbwarriors.con/contact.html The PHP is http://www.kbwarriors.com/contact-sent.php The Code For The HTML/E-mail Form IF ANYONE! Sees anything I did wrong, or sees why the living HELL it might not be working.. please spare my computer and my windows life and let me know why this isn't working :) Please :) <div id="contact-wrap"> <form action="contact-sent.php" method="post" name="contact" enctype="text/plain"> <div id="contact-reason"> <select name="reason" style='width:150px;height:20px;'> <option value="question">I have a question</option> <option value="comment">I have a comment/bug/glitch report</option> <option value="suggestion">I have a suggestion</option> <option value="other">Other</option> </select> </div> <div id="contact-first-name"><input type="text" name="firstname" style='width:100px;height:18px;border:hi… <div id="contact-armory-link"><input type="text" name="armory" style='width:400px;height:18px;border:hi… <div id="contact-e-mail"><input type="text" name="e-mail" style='width:200px;height:18px;border:hi… <div id="contact-message"><textarea name="message" style='width:560px;height:133px;backgrou… <div id="contact-submit"><input type="submit" value="Submit" style='width:150px;height:100px;border:h… </form> </div> The PHP Code: <?php if(isset($_POST['email'])) { // EDIT THE 2 LINES BELOW AS REQUIRED $email_to = "[email protected]"; $email_subject = "KB Warriors Contact Form"; function died($error) { // your error code can go here echo "We are very sorry, but there were error(s) found with the form you submitted. "; echo "These errors appear below. "; echo $error." "; echo "Please go back and fix these errors. "; die(); } // validation expected data exists if(!isset($_REQUEST['firstname']) || !isset($_REQUEST['e-mail']) || !isset($_REQUEST['armory']) || !isset($_REQUEST['reason']) || !isset($_REQUEST['message'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $comments = $_REQUEST['reason']; // required $first_name = $_REQUEST['firstname']; // required $email_from = $_REQUEST['e-mail']; // required $comments = $_REQUEST['armory']; $comments = $_REQUEST['message']; // required $error_message = ""; $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Z… if(!preg_match($email_exp,$email_from)) { $error_message .= 'The Email Address you entered does not appear to be valid. '; } $string_exp = "/^[A-Za-z .'-]+$/"; if(!preg_match($string_exp,$first_name)) { $error_message .= 'The First Name you entered does not appear to be valid. '; } if(!preg_match($string_exp,$last_name)) { $error_message .= 'The Last Name you entered does not appear to be valid. '; } if(strlen($comments) < 2) { $error_message .= 'The Comments you entered do not appear to be valid. '; } if(strlen($error_message) > 0) { died($error_message); } $email_message = "Form details below.\n\n"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:",… return str_replace($bad,"",$string); } $email_message .= "Reason For Contact: ".clean_string($reason)."\n"; $e
-
Answer:
Hi! If you really copy-pasted the code here, then you have this: if(isset($_POST['email'])) { ... but you also have this: <input type="text" name="e-mail" ... So you should change $_POST['email'] to $_POST['e-mail'], otherwise it will always be as unset variable.
Dots N Hots at Yahoo! Answers Visit the source
Related Q & A:
- How come I can't get into the chat rooms?Best solution by answers.help.ea.com
- I can't send email via windows mail. all settings for in/out mail are correct.help.Best solution by Yahoo! Answers
- HELP I CAN'T SIGN INTO MSN?Best solution by Yahoo! Answers
- Can't Access My Yahoo E-mail?Best solution by Yahoo! Answers
- I can't get any emails. What should I do?Best solution by btbusiness.custhelp.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.