0
if(document.form1.captcha.value != '$_SESSION["code"]'){
        alert("Wrongwrong captcha \n");
        return false;
    }

hello ,i just want to ask why is it not running ?i decided to convert my php function to javascript . thank you

3
Contributors
2
Replies
9
Views
3 Years
Discussion Span
Last Post by urtrivedi
0

You are not understanding the fundamental difference between javascript and php. PHP is run before the page loads, and has all of its output before the page loads. Javascript runs at run-time - that is, as the browser "reads" the script, it attempts to execute it (unless means are taken to prevent this, such as making functions or other closures, which can then be called through DOM events).

What you have above is a mix of script that will run whenever, mingled with a PHP value that doesnt exist once the page is rendered.

Without knowing context, there is not way to help you. Is this generated from the PHP? Is this written on the page and expected to execute? Is this a dynaimcally created script that loads via a src?

There are too many variables to really understand what you are trying to do.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.