Recaptcha issue. Should be an easy fix

Hello,

I am a novice with PHP, but I am thinking this should be an easy fix. I think I have most of the code implemented correctly but need to still somehow POST the information from the form through to the clients email.

Here is my form code itself.


						<form method="POST" action="verify.php">
						
						<p>Email Address:<br>					
						<input type="text" size="25" name="EmailFrom">
						
						<p>Name/Company:<br>
						<input type="text" size="25" name="Name">
						
						<p>Comment/Question:<br>
						<textarea name="Comment" cols=30 rows=3></textarea>
        <?php
          require_once('recaptchalib.php');
          $publickey = "(my key is entered in here)"; 
          echo recaptcha_get_html($publickey);
        ?>
						
						<p><input type="submit" name="submit" value="Send Request">
						</form>	

Here is my verify.php file


  <?php
  require_once('recaptchalib.php');
  $privatekey = "(my key is entered here)";
  $resp = recaptcha_check_answer ($privatekey,
                                $_SERVER["REMOTE_ADDR"],
                                $_POST["recaptcha_challenge_field"],
                                $_POST["recaptcha_response_field"]);

  if (!$resp->is_valid) {
    // What happens when the CAPTCHA was entered incorrectly
    die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
         "(reCAPTCHA said: " . $resp->error . ")");
  } else {
    // Your code here to handle a successful verification
  }
  ?>

My question is, How do I pass the information through above for the “else” option. The original form posted data to a file called contact_p.php. How can I pass my data from the name/company/comment fields through to contact_p.php?

I don’t want it to echo onto the page, I want the information (name/email/company/comment) to pass through to the email address I have set on the contact_p.php page.

All fields with a name attribute are automatically put in the $_POST array. So you can do

echo $_POST['name'] . " <".$_POST['emailFrom'].">";

for example. On the page it would say
Ryan B <my@email.com>
if i entered that into the form

Anyone able to lend a hand? Sorry for bumping but I am getting some heat from my customer.

What do you mean pass through? you want to get an e-mail?
My echo was simply a demo how to use it. Since you have a form, and you supplied

 <input type="text" size="25" name="Name">

Once you hit submit, because you are using the post action in the form, all form elements within that form that has a name attribute (name=“…”) are automagically put into the $_POST array as $_POST[‘whateve the name is’]. (If you used the get method, they are in $_GET). So then you can grab the email address using $_POST[‘emailFrom’]. A lot of people then cast the $_POST[‘emailFrom’] into a nicer variable name using the usual way of casting a variable.

$email = $_POST['emailFrom']

now $email is that value and acts like a regular variable.

<?php
session_start();
  require_once('recaptchalib.php');
  $privatekey = "(my key is entered here)";
  $resp = recaptcha_check_answer ($privatekey,
                                $_SERVER["REMOTE_ADDR"],
                                $_POST["recaptcha_challenge_field"],
                                $_POST["recaptcha_response_field"]);

  if (!$resp->is_valid) {
    // What happens when the CAPTCHA was entered incorrectly
    die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
         "(reCAPTCHA said: " . $resp->error . ")");
  } else {
    // Your code here to handle a successful verification
    $_SESSION['keeppostalive'] = $_POST;
    header('Location: contact_p.php');
  }
  ?>

And then in contact_p.php you would do something like this:

<?php
session_start();
$email = $_SESSION['keeppostalive']['email'];
$name = $_SESSION['keeppostalive']['name'];
$comment = $_SESSION['keeppostalive']['comment'];

// Do what ever comes next;

?>

Add your own security…make sure the POST data is coming from your form, scrub the variable values, and anything else you can think of…