PHP中的链接未显示

PHP中的链接未显示,php,hyperlink,Php,Hyperlink,我正在创建一个面板,允许用户返回到以前的页面。然而,我对第二个环节有困难 <a href='discussions.php'><?php echo $category_section; ?></a> <?php $back_topics; ?> <a></a> $back_topics ="<a href='forum_view_category.php

我正在创建一个面板,允许用户返回到以前的页面。然而,我对第二个环节有困难

<a href='discussions.php'><?php echo $category_section; ?></a>
                <?php $back_topics; ?>
                <a></a>

$back_topics ="<a href='forum_view_category.php?cid='".$cid."'>Back to Topics</a>";

";
链接框中没有显示任何内容。我怎么了

更新

$stmt->bind_result($topic_id, $category_id, $topic_title, $topic_creator, $topic_last_user, $topic_date, $topic_reply_date, $topic_views); 

    if (!$stmt) {
        throw new Exception($con->error);
    }
}
$stmt->store_result();
$numrows = $stmt->num_rows;

if($numrows == 1){
?>
        <div class="page_background">
            <div class="page">
                             <div class="forum_links_out">
                    <a href='discussions.php'>Discussions</a>
                    <a href='discussions.php'><?php echo $category_section; ?></a>
                    <?php
                    $back_topics ="<a href='forum_view_category.php?cid=$cid'>".$topic_title."</a>";
                     echo $back_topics; ?>
                    <a></a>
                </div>

<?php

        if ( $_SESSION['user'] ) { 
            echo "<input type='submit' class='repy_view_topic_button' value='Reply to Thread' onclick=\"window.location = 
        'forum_post_reply.php?cid=".$cid."&tid=".$tid."'\">";
        } else {
            echo "<p>Please log in to add your reply</p>";
        }
?>      
        <table class="forum_view_topic_table">
<?php
        }

        while ($row = $stmt->fetch()) {
        //added in topic title variable
?>
        <div class="view_topic_thread_name_out">
            <div class="view_topic_thread_name">Thread: <?php echo $topic_title;?></div>
        </div>  
$stmt->bind_result($topic_id、$category_id、$topic_title、$topic_creator、$topic_last_user、$topic_date、$topic_reply_date、$topic_views);
如果(!$stmt){
抛出新异常($con->error);
}
}
$stmt->store_result();
$numrows=$stmt->num_行;
如果($numrows==1){
?>

查看您正在生成的HTML:

$back_topics ="<a href='forum_view_category.php?cid='".$cid."'>Back to Topics</a>";
                       ^--start href value          ^--end href value
你想要

$back_topics ="<a href='forum_view_category.php?cid=$cid'>Back to Topics</a>";
                                                   ^^^^^
$back_topics=”“;
^^^^^
取而代之。

原版

<a href='discussions.php'><?php echo $category_section; ?></a>
<?php $back_topics; ?>
            <a></a>
 $back_topics ="<a href='forum_view_category.php?cid='".$cid."'>Back to Topics</a>";

";
改为

$back_topics ="<a href='forum_view_category.php?cid='".$cid."'>Back to Topics</a>";
<a href='discussions.php'><?php echo $category_section; ?></a>
<?php echo $back_topics; ?>
$back_topics=”“;

您忘记了
echo
在回显变量之前一定要先放置好变量。当我回显
$topic\u title
变量时,为什么这个变量不回显
$back\u topics
呢?我的变量是这样的
$back\u topics=”“;echo$back\u topics;?>
变量转储($topic\u title)
看看里面有什么。它是空的,我想我知道为什么。我试图从我查询的bind\u结果中获取
$topic\u title
,但是我的fetch和while循环上有变量“$topic\u title”,但我不确定如何才能做到这一点,因为我无法移动fetch/while循环,否则它可能会影响页面的其余部分。我是更新了我的问题以显示页面。我是否需要进行单独的查询才能获得该页面?
$back_topics ="<a href='forum_view_category.php?cid='".$cid."'>Back to Topics</a>";
<a href='discussions.php'><?php echo $category_section; ?></a>
<?php echo $back_topics; ?>