PHP无法在WHILE LOOP中调用脚本中的函数

时间:2018-01-01 14:16:10

标签: php

“。$ row ['title']。”“; / *按钮无法在脚本中调用函数* /                                                  echo“”;                                                        $ query = mysqli_query($ link,“SELECT * FROM careerdetails WHERE careerTitle ='”。$ row ['title']。“'”);

                                                        while($ row1 = mysqli_fetch_array($ query)){                                                             echo'

    ';                                                                 echo'
  • ';                                                                     echo''。$ row1 ['qualifications']。'';                                                                 echo'
  • ';                                                             echo'
';                                                         }                                                  回声'';                                          }                             ?>                                                                                           function myFunction(id){                                     警报(ID);                                     var x = document.getElementById(id);                                     if(x.className.indexOf(“w3-show”)== -1){                                         x.className + =“w3-show”;                                     } else {                                         x.className = x.className.replace(“w3-show”,“”);                                     }                                 }                             

1 个答案:

答案 0 :(得分:0)

删除(id)$index++

周围的单引号
  echo "<button onclick='myFunction(" .$index++.")' 
        class='w3-button w3-block w3-left-align'>".$row['title']."</button>";