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">

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...