RE: PHP submit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

 

here the solution for your own captcha.

 

Your condition for php captch-sol correct. you no need to go back the
previous. its bad idea.

 

past the code below your condition.

 

if ($_REQUEST["resp"] = 'incorrect-captcha-sol')
{
            echo('Incorrect Verification');

            #to get all posted values

foreach($_POST as $key=>$value){

            $$key=$value;

}
}else{

            insert or whatever you going to dooooooooooo

}



 

 

then you have to mentioned Value attribute in your all form fields like as
the same field name in php .

 

like as

 

\<tr>
<td align="right" nowrap></td>
<td><input type="hidden" name="hid" value="<?php echo $hid; ?>"></td>
</tr>
<tr>
<td align="right" nowrap>* First Name </td>
<td><input type="text" name="FirstName" 
id="FirstName" class="myinp"  value="<?php echo $FirstName; ?>"></td>
</tr>
<tr>
<td align="right" nowrap>* Last Name </td>
<td><input name="LastName" id="LastName" 
type="text" class="myinp" value="<?php echo $LastName; ?>"></td>
</tr>

 

 

 

Thanks,

Muthukumar Selvarasu,

Project Manager (Web Development),

Webmasters Ltd.



  _____  

From: php-objects@xxxxxxxxxxxxxxx [mailto:php-objects@xxxxxxxxxxxxxxx] On
Behalf Of cathy
Sent: Tuesday, December 11, 2007 4:56 AM
To: php-objects@xxxxxxxxxxxxxxx
Subject:  PHP submit

 

Hi, i have the next problem, i have 2 forms, one where i only show 
the textfields and the other where i submit the information, i want 
in my submit form return me a error value to my first page .
THE REQUEST METHOD IS NOT WORKING PROPERLY
Here is the code,PLEASE HELP
FORM2.PHP
<form name="requestfree" method="post" action="/formS2.php">
<?

if ($_REQUEST["resp"] = 'incorrect-captcha-sol')
{
echo('Incorrect Verification');
}
?>

<table border="0" cellspacing="0" cellpadding="4">

<tr>
<td align="right" nowrap></td>
<td><input type="hidden" name="hid"></td>
</tr>
<tr>
<td align="right" nowrap>* First Name </td>
<td><input type="text" name="FirstName" 
id="FirstName" class="myinp"></td>
</tr>
<tr>
<td align="right" nowrap>* Last Name </td>
<td><input name="LastName" id="LastName" 
type="text" class="myinp"></td>
</tr>
<tr>
<td align="right" nowrap>Customer Login email 
address<br>(<i>Existing customers only</i>)</td>
<td><input type="text" 
name="CustomerLoginEmail" id="CustomerLoginEmail" class="myinp" 
onblur="CustomerLoginEmail_onblur();"></td>
</tr>
<tr>




<br/>

<tr>
<td colspan="2" align="center"><?php


require_once('recaptchalib.php');

// Get a key from http://recaptcha. <http://recaptcha.net/api/getkey>
net/api/getkey
$publickey = "6LdXwgAAAAAAABI2lfSWYknFgW1zDGneKrtkV1LM ";
$privatekey = "6LdXwgAAAAAAAAapDSozUmMc4rKTz0TeRSYdIFb- ";

echo recaptcha_get_html($publickey, $error);
?></td>
</tr>
<td colspan="2" align="center"><input 
type="submit" name="Submit" value="Send Form"></td>
</tr>
</table>

</form>

HERE IS THE SUBMIT FORM
FORMS2.PHP
<?php
session_start();

require_once('recaptchalib.php');

// Get a key from http://recaptcha. <http://recaptcha.net/api/getkey>
net/api/getkey
$publickey = "6LdXwgAAAAAAABI2lfSWYknFgW1zDGneKrtkV1LM ";
$privatekey = "6LdXwgAAAAAAAAapDSozUmMc4rKTz0TeRSYdIFb- ";

//$_SESSION['resp'] = 'whatever';
//$_SESSION['error'] = $whatever;

# the response from reCAPTCHA
global $resp ;
# the error code from reCAPTCHA, if any
global $error;

# was there a reCAPTCHA response?
if ($_REQUEST["recaptcha_response_field"]) {
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_REQUEST
["recaptcha_challenge_field"],
$_REQUEST
["recaptcha_response_field"]);

if ($resp->is_valid) {
// echo "You got it!";
header("Location: formS2.php");
} else {
# set the error code so that we can display it
//if not ($resp ->is_valid){
$error = $resp->error;
header("Location: form2.php?resp=
{$error}");
//header ("Location: form2.php");

echo recaptcha_get_html($publickey, 
$error);

exit();
//die ("The reCAPTCHA wasn't entered 
correctly. Go back and try itagain." . "(reCAPTCHA said: " . $resp-
>error . ")"); 
}
}
i WANT TO RETRIEVE THE ERROR value TO FORM2.PHP

 



[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux