madhattan Posted September 16, 2009 Author Share Posted September 16, 2009 I added the above code, then tried to submit and got the following... bool(false) , D & C Contact Form Submission, Name: ghghgh Company: ghghghgh Email: ghghgh@ghghg.com Message: ghghghgh... , From: Quote Link to comment Share on other sites More sharing options...
MadTechie Posted September 16, 2009 Share Posted September 16, 2009 Hummm D & C Contact Form Submission doesn't look like a valid ToEmail to me I added the above code, then tried to submit and got the following... bool(false) , D & C Contact Form Submission, Name: ghghgh Company: ghghghgh Email: ghghgh@ghghg.com Message: ghghghgh... , From: Quote Link to comment Share on other sites More sharing options...
madhattan Posted September 16, 2009 Author Share Posted September 16, 2009 That is the subject. $EmailFrom = "contact@depaulaclark.com"; $Subject = "D & C Contact Form Submission"; $Name = Trim(stripslashes($_POST['Name'])); $Company = Trim(stripslashes($_POST['Company'])); $Email = Trim(stripslashes($_POST['Email'])); $Message = Trim(stripslashes($_POST['Message'])); Quote Link to comment Share on other sites More sharing options...
MadTechie Posted September 16, 2009 Share Posted September 16, 2009 The output you supplied is incorrect then have you tried echoing the value ? $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); var_dump($success); die("$EmailTo,\n$Subject,\n$Body,\nFrom: <$EmailFrom>"); I added the above code, then tried to submit and got the following... bool(false) , D & C Contact Form Submission, Name: ghghgh Company: ghghghgh Email: ghghgh@ghghg.com Message: ghghghgh... , From: Quote Link to comment Share on other sites More sharing options...
madhattan Posted September 16, 2009 Author Share Posted September 16, 2009 that is the output. Maybe the $EmailTo part is wrong so its not echoing? Would it have to do with making the URLs the following: <li><a href="http://www.depaulaclark.com/contact.php?name=1">Cynthia DePaula</a></li> <li><a href="http://www.depaulaclark.com/contact.php?name=2">Lily Clark</a></li> <li><a href="http://www.depaulaclark.com/contact.php?name=3">Gina Lasko</a></li> <li><a href="http://www.depaulaclark.com/contact.php?name=4">Sarwar Chowdhury</a></li> <li><a href="http://www.depaulaclark.com/contact.php?name=5">Nathan Sherwoon</a></li> <li><a href="http://www.depaulaclark.com/contact.php?name=6">Jay Rahman</a></li> <li><a href="http://www.depaulaclark.com/contact.php?name=7">Tommy Allen</a></li> And then switching like this? switch($_GET['name']) { case '1': $EmailTo = 'cynthia@depaulaclark.com'; break; case '2': $EmailTo = 'lily@depaulaclark.com'; break; case '3': $EmailTo = 'gina@depaulaclark.com'; break; case '4': $EmailTo = 'sarwar@depaulaclark.com'; break; case '5': $EmailTo = 'nathan@depaulaclark.com'; break; case '6': $EmailTo = 'jay@depaulaclark.com'; break; case '7': $EmailTo = 'tommy@depaulaclark.com'; break; default: $EmailTo = $_GET['name']; } Quote Link to comment Share on other sites More sharing options...
MadTechie Posted September 16, 2009 Share Posted September 16, 2009 shouldn't it be switch($_POST['name']) as your using post in your form! Quote Link to comment Share on other sites More sharing options...
madhattan Posted September 16, 2009 Author Share Posted September 16, 2009 just tried with both POST and GET and still goes to error2.htm Quote Link to comment Share on other sites More sharing options...
MadTechie Posted September 16, 2009 Share Posted September 16, 2009 Yes your getting error2.htm because your not sending a valid ToEmail, Quote Link to comment Share on other sites More sharing options...
madhattan Posted September 17, 2009 Author Share Posted September 17, 2009 i see. Well, i think i have narrowed it down to when the link URLs and the default $emailto were changed, because it was working fine before this... default: $EmailTo = $_GET['name']; <li><a href="http://www.depaulaclark.com/contact.php?name=1">Cynthia DePaula</a></li> any ideas? Quote Link to comment Share on other sites More sharing options...
MadTechie Posted September 17, 2009 Share Posted September 17, 2009 Can you post both the scripts The form and contactengine.php Quote Link to comment Share on other sites More sharing options...
madhattan Posted September 17, 2009 Author Share Posted September 17, 2009 Here is the full form. <form method="post" action="contactengine.php"> <table> <tr> <td class="left"><label for="Name">Name:</label></td> <td><input type="text" name="Name" /></td> </tr> <tr> <td class="left"><label for="Company">Company:</label></td> <td><input type="text" name="Company" /></td> </tr> <tr> <td class="left"><label for="Email">Email:</label></td> <td><input type="text" name="Email" /></td> </tr> <tr> <td class="left"><label for="To">To:</label></td> <td><select name='emailto' id='emailto' value="<?php echo "name"; ?>" /> <option value="1"<?php echo ($_GET['name'] == 1) ? "Selected='selected'" : ""; ?>>Cynthia DePaula</option> <option value="2"<?php echo ($_GET['name'] == 2) ? "Selected='selected'" : ""; ?>>Lily Clark</option> <option value="3"<?php echo ($_GET['name'] == 3) ? "Selected='selected'" : ""; ?>>Gina Lasko</option> <option value="4"<?php echo ($_GET['name'] == 4) ? "Selected='selected'" : ""; ?>>Sarwar Chowdury</option> <option value="5"<?php echo ($_GET['name'] == 5) ? "Selected='selected'" : ""; ?>>Nathan Sherwood</option> <option value="6"<?php echo ($_GET['name'] == 6) ? "Selected='selected'" : ""; ?>>Jay Rahman</option> <option value="7"<?php echo ($_GET['name'] == 7) ? "Selected='selected'" : ""; ?>>Tommy Allen</option> </select></td> </tr> <tr> <td class="left"><label for="Message">Message:</label></td> <td><textarea name="Message" rows="20" cols="20"></textarea></td> </tr> </table> <div id="captcha-area"> <?php require_once('recaptchalib.php'); $publickey = "6LcqrwcAAAAAAD1UeuZI584GhZBvyE0vYVwDN2-N"; $privatekey = "6LcqrwcAAAAAANr7jMoEZ56UajiN08yZ4ouOCUKV"; # the response from reCAPTCHA $resp = null; # the error code from reCAPTCHA, if any $error = null; # are we submitting the page? if ($_POST["submit"]) { $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if ($resp->is_valid) { echo "You got it!"; # in a real application, you should send an email, create an account, etc } else { # set the error code so that we can display it. You could also use # die ("reCAPTCHA failed"), but using the error message is # more user friendly $error = $resp->error; } } echo recaptcha_get_html($publickey, $error); ?> </div> <input type="submit" name="submit" value="Submit" class="submit-button" /> </form> And here is the contact engine. <?php require_once('recaptchalib.php'); $privatekey = "6LcqrwcAAAAAANr7jMoEZ56UajiN08yZ4ouOCUKV"; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); } switch($_POST['name']) { case '1': $EmailTo = 'cynthia@depaulaclark.com'; break; case '2': $EmailTo = 'lily@depaulaclark.com'; break; case '3': $EmailTo = 'gina@depaulaclark.com'; break; case '4': $EmailTo = 'sarwar@depaulaclark.com'; break; case '5': $EmailTo = 'nathan@depaulaclark.com'; break; case '6': $EmailTo = 'jay@depaulaclark.com'; break; case '7': $EmailTo = 'tommy@depaulaclark.com'; break; default: $EmailTo = $_GET['name']; } $EmailFrom = "contact@depaulaclark.com"; $Subject = "D & C Contact Form Submission"; $Name = Trim(stripslashes($_POST['Name'])); $Company = Trim(stripslashes($_POST['Company'])); $Email = Trim(stripslashes($_POST['Email'])); $Message = Trim(stripslashes($_POST['Message'])); // prepare email body text $Body = ""; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Company: "; $Body .= $Company; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; $Body .= "Message: "; $Body .= $Message; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error2.htm\">"; } ?> Quote Link to comment Share on other sites More sharing options...
MadTechie Posted September 17, 2009 Share Posted September 17, 2009 switch($_POST['name']) should be switch($_POST['emailto']) Quote Link to comment Share on other sites More sharing options...
madhattan Posted September 17, 2009 Author Share Posted September 17, 2009 That did the trick! Thank you so much MadTechie for your help. If you are ever in Manhattan, I owe you a beer or two Quote Link to comment Share on other sites More sharing options...
MadTechie Posted September 17, 2009 Share Posted September 17, 2009 Lol okay Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.