Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How to create form captcha validation using PHP and Java Script ?

I want to create form captcha using php and java script

Comments

  • edited December 2017
    Use this code
    <?php
    $code=rand(1000,9999);
    ?>
    
    <-script start->
        function myfun(){ 
            var x = document.getElementById('captcha1').value;
            var y = <?php echo $code  ?>;
            
            if (x == y) {
                return true;
            }
            else{
                return false;
            }
        }
    <-script end->
    <-form->
    <-span-><?php echo $code;?><-/span->
    <-input id="captcha1" name="captcha" type="text">
    <-input id="button" type='submit'  onclick=" return myfun();" value='Submit'>
    <-/form->
    
Sign In or Register to comment.