在php中将变量作为查询字符串传递给a href?

在php中将变量作为查询字符串传递给a href?,php,variables,getmethod,get-method,Php,Variables,Getmethod,Get Method,无法在锚标记中传递变量($forum\u ID)。请参阅下面的代码 while($row=mysqli_fetch_array($result)){ $topic=$row['topic']; $forum_ID=$row['forum_ID']; echo $forum_ID; $count= $count+1; echo"&

无法在锚标记中传递变量(
$forum\u ID
)。请参阅下面的代码

   while($row=mysqli_fetch_array($result)){ 
                $topic=$row['topic']; 
                $forum_ID=$row['forum_ID'];
                echo $forum_ID;
                $count= $count+1;
                echo"<tr style='font-size:12px'><td>".$count."<a href='post.php?id=".$forum_ID."'>".$topic."</a></td>
                        <td></td>
                    </tr>
                    <tr>
                        <td><hr></td>
                    </tr>";
    } 
while($row=mysqli\u fetch\u数组($result)){
$topic=$row['topic'];
$forum_ID=$row['forum_ID'];
echo$forum_ID;
$count=$count+1;
回显“$count”

"; }
试试这个:

    echo'<tr style="font-size:12px"><td>'.$count.'<a href="post.php?id='.$forum_ID.'">'.$topic.'</a></td>
<td></td>
                    </tr>
                    <tr>
                        <td><hr></td>
                    </tr>';
echo'.$count'

';
在查询返回的?id=Is
forum\u id
之后使用单引号(')?它是回声吗?@SunilPachlangia会打破它。某些双引号可以删除-但结束单引号位于正确的位置。@MaggsWeb是正确的。因为他在开头用了双引号。是的,它和数字有呼应