Repeat Javascript Function in PHP foreach loop -


i have javascript function within row in foreach loop. i'd have repeat each row , have tried code. each row has element id baserate converted using code below.

my problem works on first row , doesn't rest. need solve this, , appreciated.

php:

foreach ($alllocs $allrows) - no need put complete code here.

javascript:

<script>        (var = 0; < <?php echo $alllocs; ?>.length; i++) {      var = document.getelementbyid("baserate").value;     var e = number(a).tofixed(2);      var b = number(forex.rates.krw).tofixed(2);      var c = e * b;          document.getelementbyid("welkomet").innerhtml = (c).tofixed(2);   }   </script>  

i consider foreach loop this

foreach ($alllocs $allrows) 

where should replace $alllocs $allrows in javascript code code this

<?php foreach ($alllocs $allrows){ ... ... ?> <script>        (var = 0; < <?php echo $allrows; ?>.length; i++) {      var = document.getelementbyid("baserate").value;     var e = number(a).tofixed(2);      var b = number(forex.rates.krw).tofixed(2);      var c = e * b;          document.getelementbyid("welkomet").innerhtml = (c).tofixed(2);   }   </script>  <?php ... ... } ?> 

cause $alllocs array(not single value)

check general form of foreach loop

foreach (array_expression $value){     statement } 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -