0
Anyone know why it does not work?? Does not recognize in the if()
i have: $result="<script>document.write(opc)<\script>"; if($result==1){ ... }elseif($result==0){ ...} opc maybe 1 or 0, i try with strcmp too
2 odpowiedzi
+ 2
If "it does not regonize int the if()", then you maybe have a bug that avoid $result to be equal to one previously in your script? And technically it's what you do: just berfore testing if the value of $result == 1, you assign to it a string: $result would always be different from one :P
You tell also about 'opc" that you use in the result string... if it's a Php variable, you need to include its value in the string like this:
$result = "<script>document.write(".$opc.")</script>"; // there's a mistake here to... replace you backslashe with a simple slash ;)
... but if it is a JS variable, you cannot access it with Php ^^
The JS code that you are writting will be executed on user computer, when the page with it inside will be loaded, but you seems to wait for the return value of the JS code in the string?
0
You want to make some bool $result ? Or check ? If you want to check string $result, make something like this:
if($result == "opc") {
$check == true;
}
else {
$check == false;
}
Or what do you want to do ?