Home » PHP » PHP creating and using captcha – Best and simple way

PHP creating and using captcha – Best and simple way

How to create simple but powerful captcha code using php.Here is a example of use captcha code to the form to avoid spams.I’ll describes how to create & use captcha code using php.

This is the contact form.

This is the php code to handle the submit process.Add this code form submitted page.

Note: Every time captcha code is keeping as a session variable.Because in the form validation process, validate captcha is correct or not with comparing session captcha value and form submitted value.

You already noted captcha.php file.It is generated captcha code by creating image using php.

captcha.php file

If you want to change font in the captcha, keep your font file in the fonts folder.

If you want to put both letters and numbers into the captcha code you can do it using following function.
I’ll generate captcha code with mixing of letters and numbers.

How to call to this function ?

That’s only.

View Demo

Download PHP creating and using captcha Example (160 KB)

Tags

Similar posts