I am trying to push to the javascript array after looping 200 times through the member array to push every member that matches the department selected description into the javascript array., However it fails

<? $i = 0 ;
    while( $i < 200)

            if ($members[$i]['department'] == $depttts){
                  echo "<script type='text/javascript'>contacts.push({"NAME":"SirSaula","TITLE":"John","CONTACT":"bab","RESEARCH":"Ph.D."});</script>";

            else {



Hi Sir Suala,

It seems to me that the break command will cause the echo to be skipped every time.

Forgot to edit the break line out ignore it

Member Avatar

I don't think you can mix it like this. I'd place all the php stuff into a php array then json encode it and push that into js.