Is it possible to run php within a javascript condition?
Example:
<script>
if(variaveljs==2){
<?php
$variavelphp=20;
?>
}
</script>
Is it possible to run php within a javascript condition?
Example:
<script>
if(variaveljs==2){
<?php
$variavelphp=20;
?>
}
</script>
PHP runs on the server side, and this runs always first the Javascript code, which runs on the client. So this condition will not work, if you want to send data from the client to the server you need to use ajax