Jump to content

Noob's Form not really working.


qozmiq

Recommended Posts

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

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 . ")");
}
?>

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.