Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php $\u服务器[';路径信息';]…未定义索引:路径信息_Php_Forms - Fatal编程技术网

Php $\u服务器[';路径信息';]…未定义索引:路径信息

Php $\u服务器[';路径信息';]…未定义索引:路径信息,php,forms,Php,Forms,我使用一个代码作为标题: $fullurl=$_SERVER['PATH_INFO']; echo ' <form action="'. $fullurl .'" method="POST"> <table width="1000" border="1" cellpadding="10" id="navigationBar"> <tr> <td> <a href="/

我使用一个代码作为标题:

$fullurl=$_SERVER['PATH_INFO'];
    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>
           </form>
       ';
我试着用这些来代替:

explode('/', substr(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH),1));

$_ENV['PATH_INFO'];
但是它们也不起作用:(


就这些

而且,回显原始HTML也没有意义
使用此代码而不是您的代码

?>
  <form action="" 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>
       </form>
?>
姓名:
密码:
您也可以尝试:

<form action="<?=$_SERVER['PHP_SELF']?>" method="POST">
<input type="submit" name="form-submit" value="Submit" />

在较新的环境中,使用Apache/PHP-FPM时,您需要在PHP.ini中启用以下选项,以避免“未定义的索引:PATH_INFO


为什么不直接使用
$\u服务器['REQUEST\u URI']
?这不起作用吗?路径信息可能仅对
http://example.com/index.php/suffix
hmm..谢谢你的回答..我知道我看到了,但我确实希望页面重定向..因为我希望所有html在用户登录后都能更改格式..那么你是说如果我使用action=“”页面将重定向到自身吗不。你说的是相反的-你只是想要一个用户当前所在的页面。那么,你得到了。你最终能下定决心吗?是的,这就是我想要的。我只是不知道如果你将“”传递给操作,它将保持在同一页面上。如果我像这样放置url变量呢?variable1='2'&variable2='redirect'并将其添加到“”…添加这些url变量时,它会留在页面上吗?
?>
  <form action="" 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>
       </form>
<form action="<?=$_SERVER['PHP_SELF']?>" method="POST">
<input type="submit" name="form-submit" value="Submit" />
if (isset($_POST['form-submit'])){
    //do stuff
}
cgi.fix_pathinfo=1