提交表格不会停留在同一页面上

Submission form won#39;t stay on same page(提交表格不会停留在同一页面上)
本文介绍了提交表格不会停留在同一页面上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的表格:

    <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 中)时,我收到一条错误提示

When on my site and pressing submit (in xampp) I get an error stating

找不到对象!

在此服务器上找不到请求的 URL.上的链接引用页面似乎是错误的或过时的.请告知作者关于错误的那个页面.

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.

错误 404

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

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

我对使用 php、css 和 javascript 进行编码有点陌生,但我已经尝试了 2 天来寻找解决方案,但我一直没有想出任何办法.

I am somewhat new to coding with php, css, and javascript but I've been trying to find a solution to this for 2 days and I keep coming up with nothing.

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

I am just trying to get the form to stay on the same page after submitting or pressing sign in!

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

If anyone could help, that would be great! Thanks for reading.

推荐答案

不指定动作会将表单提交到当前页面:

Specifying no action will submit the form to the current page:

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

或者使用 $_SERVER['PHP_SELF']:

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

这篇关于提交表格不会停留在同一页面上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Convert JSON integers and floats to strings(将JSON整数和浮点数转换为字符串)
in php how do I use preg replace to turn a url into a tinyurl(在php中,如何使用preg替换将URL转换为TinyURL)
all day appointment for ics calendar file wont work(ICS日历文件的全天约会不起作用)
trim function is giving unexpected values php(Trim函数提供了意外的值php)
Basic PDO connection to MySQL(到MySQL的基本PDO连接)
PHP number_format returns 1.00(Php number_Format返回1.00)