jarvis Posted March 12, 2010 Share Posted March 12, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/195012-form-submit-shows-popup-window-with-recaptcha-and-confirm-button/ Share on other sites More sharing options...
severndigital Posted March 12, 2010 Share Posted March 12, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/195012-form-submit-shows-popup-window-with-recaptcha-and-confirm-button/#findComment-1025206 Share on other sites More sharing options...
jarvis Posted March 12, 2010 Author Share Posted March 12, 2010 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 = "[email protected]"; $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! Quote Link to comment https://forums.phpfreaks.com/topic/195012-form-submit-shows-popup-window-with-recaptcha-and-confirm-button/#findComment-1025207 Share on other sites More sharing options...
mariakaval Posted March 11, 2011 Share Posted March 11, 2011 The hard way is to create a javascript popup yourself which is going to be a herculean task. Simplest solution I found was this- http://www.skipser.toolsbysk.com/p/94/p/general/how-to-put-recaptcha-in-a-popup.html They give a complete sample implementation. Just copy paste to your page, and you have a popup captcha Quote Link to comment https://forums.phpfreaks.com/topic/195012-form-submit-shows-popup-window-with-recaptcha-and-confirm-button/#findComment-1186165 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.