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

编程入门 行业动态 更新时间:2024-10-25 08:23:53
本文介绍了提交表格不会停留在同一页面上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

这是我的表格:

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

更多推荐

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

本文发布于:2023-10-08 01:56:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1471179.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:停留在   面上   表格

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!