微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php-提交表单不会停留在同一页面上

这是我的表格:

    <form action="#" method="post">
      <input type="text" size="25" name="firstname" placeholder="First Name" value="<?PHP echo $fn; ?>"/>
      <input type="text" size="25" name="lastname" placeholder="Last Name" value="<?PHP echo $ln; ?>"/>
      <input type="text" size="25" name="username" placeholder="Username" value="<?PHP echo $un; ?>"/>
      <input type="text" size="25" name="email" placeholder="Email" value="<?PHP echo $em; ?>">
      <input type="text" size="25" name="email2" placeholder="Repeat Email" value="<?PHP echo $em2; ?>"/>
      <input type="password" size="32" name="password" placeholder="Password"/>
      <input type="password" size="32" name="password2" placeholder="Repeat Password"/><br />
      <input type="submit" name="reg" value="Sign Up!"/>

      </form>

在我的网站上并按提交(在xampp中)时,我收到一条错误消息,指出

Object not found!

The requested URL was not found on this server. The link on the
referring page seems to be wrong or outdated. Please inform the author
of that page about the error.

If you think this is a server error, please contact the webmaster.

Error 404

localhost Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7

我对使用PHP,css和javascript进行编码有些陌生,但是我一直在努力寻找解决方案,已有2天了,但我一直没有提出任何建议.

我只是想让表单在提交或按登录后保持在同一页面上!

如果有人可以帮助,那就太好了!谢谢阅读.

解决方法:

不指定任何操作会将表单提交到当前页面

<form action="" method="post">

或者使用$_SERVER [‘PHP_SELF’]:

<form action="<?PHP echo htmlspecialchars($_SERVER['PHP_SELF']); ?>" method="post">

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐