从php脚本制作可点击的文本

时间:2014-10-10 09:31:13

标签: php sql clickable

我有一个PHP脚本

<?php include 'db_connector.php';
  $result = mysqli_query($con,"SELECT operation FROM contract");
   while($row = mysqli_fetch_array($result)) {
    echo $row['operation'];
    echo "<br>";
    echo "<br>";
  }
  ?> 

产生以下输出    关于AP活动的报告

Configure & Maintain Service

Configure & Monitor SNC

Configure & Monitor Service

Report ON SNC Events

我在我的代码中使用它如下

<div class="description"><a id="openpanel"><?php include 'showall_contract.php';?></a></div>

我想知道,如何将每个列表项(即配置和维护服务)作为可点击链接?

2 个答案:

答案 0 :(得分:1)

请将锚标记内的值回显为

<?php include 'db_connector.php';
      $result = mysqli_query($con,"SELECT operation FROM contract");
       while($row = mysqli_fetch_array($result)) {
        echo "<a href='your url' >".$row['operation']."</a>";
        echo "<br>";
        echo "<br>";
      }
      ?> 

答案 1 :(得分:1)

echo "<a href='whatever_your_url_is'>".$row['operation']."</a>";