Jump to content

form submit shows popup window with recaptcha and confirm button


jarvis

Recommended Posts

Hi All,

 

Prob very simple but here goes. I've a form on a page, which needs a recaptcha field, due to design constraints however, it won't fit.

 

I therefore need it so you fill in the form, click submit, a new window appears with the recaptcha field and a confirmation button. Once you click confirm, the form is processed and the email sent.

 

What's the best way to do this please? The form script has the PHP to handle the emailing side.

Link to comment
Share on other sites

you pretty much answered your own question in your post .. but here goes.

 

1. fill out the form and POST that form to the captcha page

2. display the captcha information

3. Add the previous pages POST information to the captcha form

4. send all POST information to the confirmation page.

5. send email if everything checks out.

 

 

or you could just use a simple "captcha" like field:

 

<label for="check">What is color of this text?:</label>
<input type="text" value="answer here" name="check" id="check" />

 

if would not be AS secure, but at least it is checking for some kind of human interaction.

Link to comment
Share on other sites

Thanks, although I'm not sure how I would do it with my code:

<?php


  // process form
  if (@$_REQUEST['submitForm']) {

    // error checking
    $errorsAndAlerts = "";
    if (!@$_REQUEST['name'])                	{ $errorsAndAlerts = "Please fill out all fields\n"; }
    if (!@$_REQUEST['email'])                   { $errorsAndAlerts = "Please fill out all fields\n"; }
    else if(!isValidEmail(@$_REQUEST['email'])) { $errorsAndAlerts = "That email address is not valid\n"; }
    if (!@$_REQUEST['enquiry'])                 { $errorsAndAlerts = "Please fill out all fields\n"; }

$textToConvert = $_REQUEST['enquiry'];
$convertedText = iconv("UTF-8", "ISO-8859-1", $textToConvert);

    // send email user
    if (!$errorsAndAlerts) {
  $to      = "info@domain.co.uk";		
      $subject = "Quick Contact";
      $email    = $_REQUEST['email'];

  $headers  = "MIME-Version: 1.0\r\n";
  $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
  #$headers .= "Content-Type: text/html; charset=utf8\r\n";
  $headers .= "From: $email \r\n";
  
  $body =  "<strong>Full name</strong>: ". $_REQUEST['name'] ."<br />";
  $body .= "<strong>Email</strong>: ".$_REQUEST['email'] ."<br />";
  $body .= "<strong>Enquiry</strong>: $convertedText<br /><br />";
  $body .= "The user who sent this message had the IP address <strong>".$_SERVER['REMOTE_ADDR']."</strong><br />";

  $message = $body;	  

      // Note: The above line must be flush left or you'll get an error
      // This is a PHP heredoc.  See: http://ca2.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc

      // send message
      $mailResult = @mail($to, $subject, $message, $headers);
      if (!$mailResult) { die("Mail Error: $php_errormsg"); }

      //
      $errorsAndAlerts = "Thanks!  We've sent your email.";
      $_REQUEST = array(); // clear form values
    }

  }

?>

<!-- right quick_contact form -->

<!-- quick_contact_title -->
<div class="rh_quick_contact_title">
	<img src="images/rh_quick_enquiry_title.jpg" width="232" height="31" />
</div>
<!-- /quick_contact_title -->		


<!-- quick_contact_form -->
<div class="rh_quick_contact_content">
<form method="post">
	<input type="hidden" name="submitForm" value="1" />

	<?php if (@$errorsAndAlerts): ?>
		<div style="color: red; font-weight: bold; font-size: 12px; font-family: arial;">
		  <?php echo $errorsAndAlerts; ?>
		</div>
	 <?php endif ?>

	<table width="213" border="0" cellpadding="2" cellspacing="2">
		<tr>
			<td align="center">
				<input name="name" type="text" id="name" style="width:180px;" value="Name..." onclick="clickclear(this, 'Name...')" onblur="clickrecall(this,'Name...')" />
			</td>
		</tr>
		<tr>
			<td align="center">
				<input name="email" type="text" id="email" style="width:180px;" value="Email Address..." onclick="clickclear(this, 'Email Address...')" onblur="clickrecall(this,'Email Address...')"/>
			</td>
		</tr>
		<tr>
			<td align="center">
				<textarea name="enquiry" id="enquiry" value="Enquiry..." onclick="clickclear(this, 'Enquiry...')" onblur="clickrecall(this,'Enquiry...')" style="width:180px;" rows="4"></textarea>
			</td>
		</tr>					
		<tr>
			<td><div align="right">
				<input type="image" src="images/blue_submit_button.jpg" value="Submit" alt="Submit">  
			</div></td>
		</tr>										
	</table>	
</form>
</div>
<!-- /quick_contact_form -->

Any pointers are most gratefully received!

Link to comment
Share on other sites

  • 11 months later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.