当我输入时:
<form method="post" action="../Thread/thread.php?threadID=".<?php echo $threadID; ?>."&page=".<?php echo $page; ?> >
我明白了:
http://localhost/PoliticalForum/Thread/thread.php?threadID=
如何将变量编码到url中以避免出现此类错误?
答案 0 :(得分:3)
echo('<form method="post" action="../Thread/thread.php?threadID=' . $threadID . '&page=' . $page . '">');
你的报价有问题。
编辑:
$url = sprintf("../Thread/thread.php?threadID=%1s&page=%2s",$threadID,$page);
echo('<form method="post" action="'.$url .'">');
答案 1 :(得分:2)
报价问题试试这个
<form method="post" action="../Thread/thread.php?threadID=<?php echo $threadID; ?>&page=<?php echo $page; ?>" >
答案 2 :(得分:0)
你的报价错了,试试这个:
<form method="post" action="../Thread/thread.php?threadID=<?php echo $threadID; ?>&page=<?php echo $page; ?>">