提交表单值后,我无法将 URL 重定向到其他网页
您好,网站管理员,我正在尝试在提交表单元素后将网页重定向到不同的 URL/网页...我尝试了很多方法但无法修复它...请检查下面我迄今为止尝试过的代码...
<?php
if(isset($_REQUEST['down'])){
header("header("location: domainpath/kothi.html");
}
?>
<html>
<body>
<form action="glitter.php" method="post">
<input type="radio" name="font" value="fonts/darkcrystaloutline.ttf"/>
<input type="radio" name="font" value="fonts/darkcrystalout.ttf"/>
</form>
</body>
</html>
我已经也尝试过
<?php
if(isset($_REQUEST['font'])){
header("location: domainpath/kothi.html");
};
?>
我也尝试过
<?php
header("location: domainpath/kothi.html");
?>
请帮我解决问题......
Hello Webmasters iam trying to redirect the webpage to a different URL/webpage after submitting the form elements ...i tried many ways but could not fix it... please check the codes below that i have tried so far...
<?php
if(isset($_REQUEST['down'])){
header("header("location: domainpath/kothi.html");
}
?>
<html>
<body>
<form action="glitter.php" method="post">
<input type="radio" name="font" value="fonts/darkcrystaloutline.ttf"/>
<input type="radio" name="font" value="fonts/darkcrystalout.ttf"/>
</form>
</body>
</html>
i have also tried
<?php
if(isset($_REQUEST['font'])){
header("location: domainpath/kothi.html");
};
?>
i also tried
<?php
header("location: domainpath/kothi.html");
?>
please help me to fix the problem....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
那个文件是
glitter.php
吗?重定向脚本应保存在glitter.php
中,因为这是您提交表单时将加载的页面。有多种方法可以进行重定向。
通过元标记: http://webdesign.about.com/od/metataglibraries/a /aa080300a.htm
通过标头: http://php.net/manual/en/function.header.php(您必须在 header 语句之后放置
exit
)通过 Javascript:http://www.tizag.com/javascriptT/javascriptredirect.php
Is that file
glitter.php
? The redirection script should be kept inglitter.php
as that is the page that will be loaded when you submit the form.There are several ways to do a redirect.
via meta tag: http://webdesign.about.com/od/metataglibraries/a/aa080300a.htm
via header: http://php.net/manual/en/function.header.php (you have to put
exit
after the header statement)via Javascript: http://www.tizag.com/javascriptT/javascriptredirect.php
首先,如下:
这是不正确的,
header
声明不正确,将header
替换为下面的header
:其次,为什么
$ _请求
?你正在发一个 POST,第三,down
从哪里来?您的表单正在提交font
,因此以下是您所需要的:添加
exit()
以停止页面加载的其余部分,顺便说一句...更新
如果您也提交了数据,这可能也是最好的,因此在
正如其他人指出的那样,我希望这个 PHP 页面被称为 < code>glitter.php 这样它就可以提交给自己......
更新 2
根据您的评论,您需要以下内容:
虽然上面的表单将转到
glitter.php
并且header
将不重定向到任何地方 - 必须假设另一个表单/页面提交给这个表单/页面...Firstly, the below:
This is incorrect, the
header
is incorrectly declared, replaceheader
with theheader
below:Secondly, why
$_REQUEST
? You're making a POST, and thirdly, where isdown
coming from? You form is submittingfont
so the following is what you need:exit()
is added to stop the rest of the page loading too, by the way...Update
It may also be best if you submitted the data too, so include the below inbetween the
<form>
tagsAnd like others point out, I hope this PHP page is called
glitter.php
so it can submit to itself...Update 2
Based on your comment, then you'd want the following:
Though the above form will go to
glitter.php
and theheader
will not redirect anywhere - one has to assume that another form/page submits to this one...您有 action="glitter.php",这意味着提交表单后,结果输入将可访问到 glitter.php 文件中。因此,在该文件中,您必须重定向到您想要访问的任何网址。
You have action="glitter.php", which means after submitting the form the result inputs will be accessible into glitter.php file. So in that file you have to redirect to whatever url you wanna go.
您已经问过这个问题一次,但在这里添加:
但我有一个假设:您必须在 header() 之后创建 exit() ,因为其余部分不允许给出输出。如果它给出输出,则标头将被设置为 HTML 文档,因此无法重置。
所以试试这个:
顺便说一句:我希望这个表格在 glitter.php 中,down 的输入在哪里?
如果这个文件不是 glitter,请在 glitter: 中添加此文件,
并杀死表单页面中的 php。
You already asked this question once, but here add this :
But i have a assumption: You have to make an exit() after header() cos the rest is not allowed to be give an output. If it gives an output the header will be set to a HTML-Document and can therefore not be reset.
So try this:
BTW: I hope this form is in glitter.php and where is the input for down?
If this file is not glitter, add this in glitter:
And kill the php in the form-page.