Hi, i have a little problem with captcha validation using php and ajax. this is the php validation:
if(trim($code) == '') {
$error_captcha = '<p class="error">some empty error....</p>';
$errorc = 'error';
$error = $erdiv;
} else if (trim($code) != ''){
require_once ('securimage.php');
$captcha = new Securimage();
$valid = $captcha->check($code);
if ($valid == false) {
echo '<p class="error">some captcha incorrect error...</p>';
$error_captcha .= '<p class="error"></p>';
}
}
this is my form:
<form class="wufoo leftLabel page" action="javascript:send_action('register.php',3)">
<div class="info">
<h2>פזור - טופס רישום</h2>
<?php echo $error; ?>
</div>
<ul>
<li class="right <?php echo $erroru; ?>">
<div class="col">
<input type="text" class="field text large" id="user_register" value="<?php echo $username; ?>" maxlength="255" />
<?php echo $error_user; ?>
</div>
<label class="desc">
<span class="req">*</span>
<?php small('שם משתמש'); ?>
</label>
<p class="instruct"><small>שם המשתמש</small></p>
</li>
<li class="right <?php echo $errorp; ?>">
<div class="col">
<input type="password" class="field text large" id="pass_register" value="<?php echo $pass; ?>" maxlength="255" />
<?php echo $error_pass; ?>
</div>
<label class="desc">
<span class="req">*</span>
<?php small('סיסמא'); ?>
</label>
<p class="instruct"><small>נא הזן את סיסמתך</small></p>
</li>
<li class="right <?php echo $errorp.''.$errorpv; ?>">
<div class="col">
<input type="password" class="field text large" id="pass_val_register" value="<?php echo $pass_val; ?>" maxlength="255" />
<?php echo $error_pass_val.''.$error_pass; ?>
</div>
<label class="desc">
<span class="req">*</span>
<?php small('אימות סיסמא'); ?>
</label>
<p class="instruct"><small>נא הזן את סיסמתך שנית</small></p>
</li>
<li class="right <?php echo $errore; ?>">
<div class="col">
<input type="text" class="field text large" id="email_register" value="<?php echo $email; ?>" maxlength="255" />
<?php echo $error_email; ?>
</div>
<label class="desc">
<span class="req">*</span>
<?php small('כתובת דוא"ל'); ?>
</label>
<p class="instruct"><small>נא הקפד להזין כתובת דוא"ל חוקית על מנת שתוכל להפעיל את חשבונך</small></p>
</li>
<li class="right captcha"></li>
<li class="right <?php echo $errorc; ?>">
<div class="col">
<input type="text" class="field text large" id="captcha_register" maxlength="255" />
<p><img src="securimage_show.php?sid=<?php echo md5(uniqid(time())); ?>"></p>
<?php echo $error_captcha; ?>
</div>
<label class="desc">
<span class="req">*</span>
<?php small('קוד אבטחה'); ?>
</label>
<p class="instruct"><small>נא הזן את קוד האבטחה כפי שמופיע בתמונה</small></p>
</li>
<li class="buttons ">
<input id="saveForm" name="saveForm" class="btTxt submit" type="submit" value="שלח" />
</li>
</ul>
</form>
(that's thbrew there) The problem is that the variable $eror_captcha isn't set at all when entering a wrong string.