问题
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