Other probs to pass variable from php to js

Hi ,

I have also this probs to pass a variable :

 
<?php
$ip=$_POST['ip'];
?>

<script>
............
var unbinding = document.getElementById('unbind');
unbinding.innerHTML = '<iframe src="http://xxxxx/binding-off.php?ipclient=$ip"  "width="1" height="1"></iframe>';
.......
</script>

If i use a static value like 192.168.0.250 inside innerHTML the code work . If i use a variable $ip ( passed from other php code ) don’t work. Again sintax probs ?


Thanks in advance.

brasileottanta

Yep.

You must trigger PHP with “<?php” to access PHP variables:

<?php
$ip=$_POST['ip'];
?>


unbinding.innerHTML = '<iframe src="http://xxxxx/binding-off.php?ipclient=<?php echo $ip; ?>"  "width="1" height="1"></iframe>';

Thanks.:slight_smile: It’s incredible how complex is the sintax . When all job work , I traslate in native PHP .

Regards

brasileottanta