我正在创建一个允许用户返回上一页的面板。但是,我对第二个链接有困难。
<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>
答案 0 :(得分:4)
查看您正在生成的HTML:
$back_topics ="<a href='forum_view_category.php?cid='".$cid."'>Back to Topics</a>";
^--start href value ^--end href value
这意味着您的$cid
值本身就是一个未知/无效的属性:
<a href='forum_view_category.php?cid=' 42'>
^^^---illegal/unknown attribute
你想要
$back_topics ="<a href='forum_view_category.php?cid=$cid'>Back to Topics</a>";
^^^^^
代替。
答案 1 :(得分:0)
原创
<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; ?>