为了账号安全,请及时绑定邮箱和手机立即绑定

在新选项卡中打开用户配置文件

在新选项卡中打开用户配置文件

PHP
海绵宝宝撒 2021-06-12 14:05:16
我在表格中显示声明,我想让每一行都可以点击,这有点像我用 js onclick 函数所做的(我只能点击名称,但我想将它应用到整行)。现在我想在新选项卡中查看有关公告的详细信息。我的问题从这里开始。我想在单击一行时获得公告 ID,但不知道该怎么做。另外,我正在使用 js 进行 onclick,其余部分是 php,因此那里变得有点混乱。我知道这不是最好的方法,所以我需要你关于如何解决这个问题的建议。PS我对js不是很熟悉,那些js部分取自网络教程。下面的代码是我显示搜索结果的部分。<section id="results">    <div class="container">        <table>            <tr>                <a href="#"><th>Name</th></a>                <th>Where</th>                <th>From</th>                <th>Date</th>                <th>Price</th>                <th>Type</th>                <th>PId</th>            </tr>            <?php                if(isset($_POST['search_btn'])){                    include_once "db_connect.php";                    $from = $_POST['from'];                    $where = $_POST['where'];                    $date = $_POST['date'];                    $type = $_POST['type'];                    $procid = $_POST['proc_id'];                if(empty($from) || empty($where) || empty($date) || empty($type)){                    header("Location: index.php?search=empty");                    exit();                }else{                    $sql = "SELECT * FROM proc WHERE p_from = '".$from."' and p_where = '".$where."' and type= '".$type."' ";                    $query = mysqli_query($conn, $sql);                    $num_rows = mysqli_num_rows($query);                        while ($rows = mysqli_fetch_array($query, MYSQLI_ASSOC)) {                            echo "<tr><td onclick='content(this)'>" . $rows['p_name'] . " " . $rows['p_surname']. " </td><td>" .$rows['p_from']. "</td><td>" .$rows['p_where']. "</td><td>" .$rows['p_date']. "</td><td>" .$rows['price']. "</td><td>" .$rows['type']. "</td></tr>" ;                        }                        echo "</table>";                    }                }else{                        echo "Error!";                    }            ?>
查看完整描述

3 回答

?
哆啦的时光机

TA贡献1779条经验 获得超6个赞

试试这个

<a href="your url address" target = "_blank"> link name </a>


查看完整回答
反对 回复 2021-06-19
  • 3 回答
  • 0 关注
  • 114 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号