qozmiq Posted June 6, 2008 Share Posted June 6, 2008 I am needing to setup ReCaptcha, and had to convert my contact form to PHP. I an new to PHP, and started with a simple form. I have a form.php page, with a sendmail.php page. It seems to be working on some low level, as I get the emails, but they are empty. Here is the code I am using: from my formmail.php: <form method="post" action="sendmail.php"> Email: <input name="email" type="text" /><br /> Message:<br /> <textarea name="message" rows="15" cols="40"> </textarea><br /> <?php require_once('recaptchalib.php'); $publickey = "removed for security"; // you got this from the signup page echo recaptcha_get_html($publickey); ?> <div align="center"> <input name="Submit" type="image" value="Submit" src="/images/submit.jpg" align="middle" border="0" /></div> </form> And from my sendmail.php: <?php require_once('recaptchalib.php'); $privatekey = "removed for security"; $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 . ")"); } $email = $_REQUEST['email'] ; $message = $_REQUEST['message'] ; mail( "[email protected]", "KC-Foto Feedback Form Results", $message, "From: $email" ); header( "Location: http://www.kc-foto.com/thankyou.html" ); ?> I am missing something here blatantly obvious? I checked all the code regarding the $email and $message, and it *seems* to be right...? Any assistance anyone can provide would be appreciated. Addendum - Yes the emails are arriving, and they are coming *from* the name that is entered into the name box...but alas, the emails have zero content. Links to pages just in case it helps... http://www.kc-foto.com/form1.php http://www.kc-foto.com/sendmail.php Link to comment https://forums.phpfreaks.com/topic/108982-noobs-form-not-really-working/ Share on other sites More sharing options...
jonsjava Posted June 6, 2008 Share Posted June 6, 2008 not sure, but does ReCaptcha require sessions? if so, at the top of both of your pages, you'll need to add: <?php session_start(); Those should be the top 2 lines. If you are then outputting HTML, don't forget to add ?> after. Link to comment https://forums.phpfreaks.com/topic/108982-noobs-form-not-really-working/#findComment-559085 Share on other sites More sharing options...
qozmiq Posted June 6, 2008 Author Share Posted June 6, 2008 Not that I (noob) knows of, I can't find anything in the documentation or on any forum or board. Did everything else look okay? Link to comment https://forums.phpfreaks.com/topic/108982-noobs-form-not-really-working/#findComment-559090 Share on other sites More sharing options...
jonsjava Posted June 6, 2008 Share Posted June 6, 2008 Ok, it doesn't use sessions. I'm looking for anything else that may be going wrong now.... I changed your sendmail sendmail.php <?php require_once('recaptchalib.php'); $privatekey = "removed for security"; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if ($resp->is_valid) { $email = $_REQUEST['email'] ; $message = $_REQUEST['message'] ; mail( "[email protected]", "KC-Foto Feedback Form Results", $message, "From: $email" ); header( "Location: http://www.kc-foto.com/thankyou.html" ); } else{ die ("The reCAPTCHA wasn’t entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); } ?> Link to comment https://forums.phpfreaks.com/topic/108982-noobs-form-not-really-working/#findComment-559100 Share on other sites More sharing options...
qozmiq Posted June 6, 2008 Author Share Posted June 6, 2008 Well, I think I figured out the issue. It was a html label tag the was blocking the sendmail from seeing the message content. I think. Not sure really, but its working. Now for the bigger issue. Wait, I should repost this, as its a completely different issue...thanks for your help, trully. Link to comment https://forums.phpfreaks.com/topic/108982-noobs-form-not-really-working/#findComment-559162 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.