To hide a value from a form
$orderno = ";
if ($orderno = = "333")
{
echo ' OK '. $orderno;
}
else{
Echo ' NO2 ';
}
I want to use this method to pass the value of JS to PHP variable, the above code, echo $orderno when the value is 333, but why the following execution of the IF statement to always execute the content of else, why the value is not equal?? Urgent Request!! Thank you, guys.
Reply to discussion (solution)
PHP runs in front, JS runs in the back
After PHP runs, JS starts to run
So during an HTTP session:
JS can send data to PHP, and accept the data returned by PHP
Not in the opposite way.
But Echo can print out the document.write ("333"), this is how to explain, thank you thanks
This, of course, only executes the Else branch ... If you need to pass the value of JS to the PHP variable. Can I use the Ajax,dwr method?
But Echo can print out the document.write ("333"), this is how to explain, thank you thanks
Echo $orderno; The server-side parsing outputs a line of strings that should have seen "
But see 333, this is because the client script immediately output 333, this 333 is not the echo direct output value
-----------------
This question, to understand that PHP is a server-side operation, script---document.write is running on the client, there are sequencing
$orderno = ";
Echo GetType ($orderno); String
$orderno the current value is string string==333? Must not be true, so always perform else's content
Var_dump ($orderno); See the source code to see not 333
$orderno = ";
There must be something wrong with this print.
But Echo can print out the document.write ("333"), this is how to explain, thank you thanks
Echo $orderno; The server-side parsing outputs a line of strings that should have seen "
But see 333, this is because the client script immediately output 333, this 333 is not the echo direct output value
-----------------
This question, to understand that PHP is a server-side operation, script---document.write is running on the client, there are sequencing
$orderno = ";
Echo GetType ($orderno); String
$orderno the current value is string string==333? Must not be true, so always perform else's content
I understand, thank you very much!!