$fullurl=$_SERVER['PATH_INFO'];
if(isset($_POST['name']) && isset($_POST['login']) && isset($_POST['pass']))
{
echo '
<form action=".'$fullurl'." method="POST"/>
<table width="1000" border="1" cellpadding="10" id="navigationBar">
<tr>
<td> <a href="/PoliticalForum/controlPanel.php">Control Panel</a></td>
<td> <a href="/PoliticalForum/checkEmail.php">Donate</a> </td>
<td> <a href="/PoliticalForum/mainHome.php">Logout</a> </td>
</tr>
</table>
';
}
else
{
echo '
<form action=".'$fullurl'." method="POST"/>
<table width="1000" border="1" cellpadding="10" id="navigationBar">
<tr>
<td> <a href="/PoliticalForum/Registration.php">Register</a></td>
<td> <a href="/PoliticalForum/controlPanel.php">Control Panel</a></td>
<td> <a href="/PoliticalForum/checkEmail.php">Donate</a> </td>
<td align="right">name:<input name="name" type="text" /></td>
<td>password:<input name="pass" type="text" /> <input name="login" type="submit" value="Login" /> </td>
</tr>
</table>
';
}
我想同樣的URL將被傳遞到行動,但它給了我一個錯誤:如何鏈接一個字符串的PHP變量?
Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in C:\xampp\htdocs\PoliticalForum\headerSite.php on line 9
,也將在$ fullurl會給我當前網頁的網址?
也許使用[定界符字符串語法](http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc )以避免這種錯誤。 – mario