My question:
I need a JavaScript variable to pass to a PHP variable. I have done this, but the passed PHP variable does not support input text field value=""
attribute. How can I fix this problem?
<input type="number" onchange="myFunction()" >
<script>
function myFunction() {
var x = 4;
document.getElementById("demo").innerHTML = x;
}
</script>
Working $p
:
<?php
$p ='<p id="demo"></p>';
echo $p;
?>
But, $p
variable does not work within value=''
<input type='text' name='p3' value='<?= $p ?>'>