【问题标题】:How to make a URL that is dislayed to be a clickable link?如何使显示为可点击链接的 URL?
【发布时间】:2023-01-24 14:33:03
【问题描述】:

如何使通过表单提交的 url 在显示到表格中时可点击?

<div class="content">
<body>
<table border ="1" cellpadding="0">
    <tr>
        <th>Date Uploaded</th>
        <th>No.</th>
        <th>Topic</th>
        <th>Link</th>
        <th>Uploaded By:</th>
        <th>Operation</th>
        <th style="background-color: green;"><a href="add_quiz.php">+</th>
    </tr>

<!--php code to display db content-->
    <?php
    $num = mysqli_num_rows($query);
    if ($num>0) {
        while ($result = mysqli_fetch_assoc($query)) {
            echo "    
            <tr>
               <td>".$result['quiz_date']."</td>
               <td>".$result['quiz_no']."</td>
               <td>".$result['quiz_topic']."</td>
               <td>".$result['quiz_link']."</td>
               <td>".$result['quiz_upby']."</td>

               <td>
                    <a href='Villangca_quiz.php?quiz_no=".$result['quiz_no']."' onClick=\"javascript:return confirm('Are you sure you want to delete this?');\"class='btn'>DELETE</a>
                    <a href='DrDental_update.php?quiz_no=".$result['quiz_no']."' class='btn'>UPDATE</a>
               </td>
            </tr>
                ";
        }
    }
    ?>
</table>

我需要 quiz_link 是一个通过表单提交的可点击 URL

【问题讨论】:

    标签: php html mysql


    【解决方案1】:

    您可以使用如下所示的htmlspecialchars_decode 函数从数据库或字符串中显示为 HTML:

    <td>".htmlspecialchars_decode($result['quiz_link'])."</td>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-14
      • 2016-03-29
      • 1970-01-01
      • 2020-06-08
      • 2021-12-01
      • 1970-01-01
      • 2021-06-15
      • 2014-02-22
      相关资源
      最近更新 更多