Archives for 


How to add Captcha Code in PHP form?

What is Captcha Code?

Captcha code is a type of challenge to users who submits form on your website or in your blog. Captcha code is usually images in awkward font family or italic.Recently lots of people using some logical equations like 5+2?.

Why do we need Captcha?

Captcha code is used to prevent spam comments from automated software and users.

If you don’t prevent spam comments then your database will be overloaded by lots of spam comments.

Now let’s start How to add captcha code in php?

Actually using following procedure,you can implement for any programming language like PHP,ASP,JSP etc.

Google gives Recaptcha service for free.You just have to login to your existing account with My Account Link.

After login with Recaptcha,Click on Add a New Site,You will prompt to following Screen, Google-Recaptcha

  • Give your domain name like and press Generate key Button.
  • You will get your Public Key & Private key.
  • Just replace your public key with $publickey variable’s value.


  • Now add above code with your pubic key in your page that you want to display captcha code.
  • You also need to add recaptchalib.php file which will you can get from your Captcha account.Make sure that your recaptchalib.php file is in same directory.

Customize recaptcha look Now if you want to customize your default look of your captcha Image,then put below code between head tag replacing script replacing theme_name with your favorite theme either blackglass,white or clean

You can also customize your theme.For more details,visit Customize Recpatcha