-2

I have the following code which makes sure the text entered in the "captcha" text box is at least 3 characters long or else an error is received. How do i set it so the text entered has to be "abcd" or else an error occurs?

  if(strlen($_POST['captcha']) < 3) {
    $error_message .= 'Please ensure the captcha entered is at least 3 characters long';
4

1 回答 1

0

我假设您也想检查大小写,在这种情况下您可以:

if (strcmp($_POST['captcha'], "abcd"))
  $error_message .= "Your captcha does not match!";
于 2013-03-22T00:33:58.523 回答