making clickable text from php script

我们两清 提交于 2020-11-30 01:42:06

问题


I have a php script below

<?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>";
  }
  ?> 

That produces the following output Report on AP Events

Configure & Maintain Service

Configure & Monitor SNC

Configure & Monitor Service

Report ON SNC Events

Am using it in my code as follows

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

I would like to know, how can I make each list item (i.e Configure & Maintain Service) as a clickable link?


回答1:


Please echo the values inside anchor tag as

<?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>";
}



回答2:


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


来源:https://stackoverflow.com/questions/26296210/making-clickable-text-from-php-script

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!