"/> "/> "> "/> 当在我的网站上并按下-6ren">
gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 05:28:33 25 4
gpt4 key购买 nike

这是我的表格:

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

关于php - 提交表格不会停留在同一页面上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17280809/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com