divinedesigns1 Posted September 8, 2012 Share Posted September 8, 2012 im having problem sending messages from the contact form to my email, so i want to know if i made a error or not, i dont see anything wrong with the contact script at allthis is the code below if(isset($_POST['submit_contact'])){// define the variables$fullname = $_POST['fn'];$company = $_POST['cn'];$email = $_POST['email'];$sub = $_POST['sub'];$opinion = $_POST['coc'];// filter the variable$fullname = strip_tags($fullname);$fullname = stripslashes($fullname);$company = strip_tags($company);$company = stripslashes($company);$email = strip_tags($email);$email = stripslashes($email);$opinion = strip_tags($opinion);$opinion = stripslashes($opinion);// check if the variables are emptyif(empty($fullname) && empty($company) && empty($email) && empty($opinion) && empty($sub)){echo '<div id="errors">all fields are requested</div>';}elseif(empty($fullname)){echo '<div id="errors">Please Enter Your Name' . '<br/>';}elseif(empty($company)){echo '<div id="errors">Please Enter Your Company Name, If You Do Not Have A Company Please Enter' . ' <span>None</span> ' . '</div><br/>';}elseif(empty($email)){echo '<div id="errors">Please Enter A Valid Email' . '</div><br/>';}elseif(empty($opinion)){echo '<div id="errors">Text Is Required' . '</div><br/>';}elseif(empty($sub)){echo '<div id="errors">Subject Is Requested' . '</div><br/>';}elseif(!empty($fullname) && !empty($company) && !empty($email) && !empty($opinion) && !empty($sub)){// define the receiver$to = "dwayne@divinedesigns1.net";$subject = $sub;$from = $fullname;$message = $opinion;$headers = 'From: $from';mail($to, $subject, $message, $headers);echo '<div id="errors">We will response to you as soon as possible</div>';$fullname = "";$company = "";$email = "";$opinion = "";$sub = "";} Link to comment Share on other sites More sharing options...
Don E Posted September 8, 2012 Share Posted September 8, 2012 Not sure what the problem may be but this: $headers = 'From: $from'; should probably be: $headers = "From: $from"; with double quotes instead of single quotes. Link to comment Share on other sites More sharing options...
niche Posted September 9, 2012 Share Posted September 9, 2012 If Don E's post didn't answer you're OP, what error's are you getting? Link to comment Share on other sites More sharing options...
divinedesigns1 Posted September 9, 2012 Author Share Posted September 9, 2012 Not sure what the problem may be but this: $headers = 'From: $from'; should probably be: $headers = "From: $from"; with double quotes instead of single quotes.ok ill try thatIf Don E's post didn't answer you're OP, what error's are you getting?php doesnt always give an error when something doesnt work, could just be a type or something missed scripted Link to comment Share on other sites More sharing options...
niche Posted September 9, 2012 Share Posted September 9, 2012 (edited) That's why I said that your script is simply doing what you told it to do. That equals no error (in this case). So, check the values in your logic. You're expecting one of your ifs to trip, but it's not. Hence, no error. Check your condition values by echoing each one. Without actually being able to run your script, that's where I think you'll find the problem. Edited September 9, 2012 by niche Link to comment Share on other sites More sharing options...
divinedesigns1 Posted September 9, 2012 Author Share Posted September 9, 2012 That's why I said that your script is simply doing what you told it to do. That equals no error (in this case). So, check the values in your logic. You're expecting one of your ifs to trip, but it's not. Hence, no error. Check your condition values by echoing each one. Without actually being able to run your script, that's where I think you'll find the problem.my localhost doesnt have a mta hehe but it works on my host tho Link to comment Share on other sites More sharing options...
niche Posted September 9, 2012 Share Posted September 9, 2012 mta? Link to comment Share on other sites More sharing options...
divinedesigns1 Posted September 11, 2012 Author Share Posted September 11, 2012 ok it doesnt have a email handler, so sending a email through my localhost wouldnt work Link to comment Share on other sites More sharing options...
niche Posted September 11, 2012 Share Posted September 11, 2012 Get a wampserver so you can send emails from your localhost.. It's free. http://www.wampserver.com/en/ Link to comment Share on other sites More sharing options...
thescientist Posted September 11, 2012 Share Posted September 11, 2012 Get a wampserver so you can send emails from your localhost.. It's free. http://www.wampserver.com/en/ you would still need to configure an SMTP server. It won't be done automatically. 1 Link to comment Share on other sites More sharing options...
niche Posted September 11, 2012 Share Posted September 11, 2012 Didn't realize a wamp needed SMTP only. That's good to know. Thanks again scientist. Link to comment Share on other sites More sharing options...
divinedesigns1 Posted September 12, 2012 Author Share Posted September 12, 2012 yeah im using a wamp server and im not sure how to config it but then again i have a host so ill just pop it in there when needed Link to comment Share on other sites More sharing options...
niche Posted September 12, 2012 Share Posted September 12, 2012 per thescientist's #10, you need a SMTP email account so check with your provider. Link to comment Share on other sites More sharing options...
divinedesigns1 Posted September 15, 2012 Author Share Posted September 15, 2012 per thescientist's #10, you need a SMTP email account so check with your provider.nope i dont believe thats what he meant, to my knowledge he meant you would need to config the smtp within the wamp server to be able to pass emails using the wamp server, but since i have a host i dont need to config it on my wamp server ill just use my host to test the forms Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now