Community discussions

MikroTik App
 
brasileottanta
Member Candidate
Member Candidate
Topic Author
Posts: 122
Joined: Thu Jun 22, 2006 8:52 am

Other probs to pass variable from php to js

Sat May 25, 2013 4:21 pm

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
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: Other probs to pass variable from php to js

Sat May 25, 2013 4:26 pm

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>';
 
brasileottanta
Member Candidate
Member Candidate
Topic Author
Posts: 122
Joined: Thu Jun 22, 2006 8:52 am

Re: Other probs to pass variable from php to js

Sat May 25, 2013 4:50 pm

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.:-) It's incredible how complex is the sintax . When all job work , I traslate in native PHP .

Regards

brasileottanta

Who is online

Users browsing this forum: No registered users and 10 guests