无法获取header()来重定向 [英] can't get header() to redirect

查看:83
本文介绍了无法获取header()来重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请原谅我的无知,因为我是来自ms背景的php的新手...


如果我创建一个名为redirect.php的页面,它只是内容是:

<?php

header(" Location:http://www.google.com");

? >

它是否应该重定向到 www.google.com?我无法获得标题()

重定向功能。


我正在尝试在线预订...客户在SignUp.php填写

联系人和账单信息。 SignUp.php上的表单

提交给Confirm.php,我在那里执行验证。


如果输入验证失败,我想重定向回SignUp .php。

否则我会在处理

订单之前显示输入以进行确认。也许我正在实现这个错误...使用asp思考

用于php实现,但我认为这应该很简单,我必须

丢失一些东西。


谢谢。

解决方案

Bob Garbados写道:


[...]

如果输入验证失败,我想重定向回SignUp.php。
否则我会在处理之前显示输入以进行确认订单。也许我正在实现这个错误...使用asp思考
进行php实现,但我认为这应该很简单,我必须要错过一些东西。


而不是重定向(顺便说一下你收到任何错误信息吗?)为什么

如果没有你重新显示表格的话没有正确填写?而且现在你需要b $ b,向用户显示什么是错的(例如:他没有填写什么)

谢谢。



HTH,

塞巴斯蒂安

-

世界上最有可能的方式被摧毁,大多数专家同意,b $ b是偶然的。

这就是我们进来的地方;我们是计算机专业人士。

我们造成事故。

--Nathaniel Borenstein


" Bob Garbados" ;写道:

原谅我的无知,因为我是一个来自ms
背景的新手...

如果我创建一个名为redirect.php的页面并且它的唯一内容是:
<?php
标题(位置:http://www.google.com");
?>
应该它没有重定向到 www.google.com?我无法获得
标题()
重定向功能。

我试图在线预订...客户在SignUp.php填写
联系人和账单信息。 SignUp.php上的表单
提交给Confirm.php,我在那里执行验证。

如果输入验证失败,我想重定向回
SignUp.php。否则,我将在
处理订单之前显示输入以进行确认。也许我?实现这个错误...使用asp
思考
进行php实现,但我认为这应该很简单,而且
必须遗漏一些东西。

谢谢。




通常的方法是在同一个脚本上处理表单,并且只有在一切正常时才重定向

。原因与后期变量有关,

和人们回到prev。页面(复杂,但请接受我的话)。

如果你重定向,请确保没有写出任何内容(例如标题

东西,空格等)。它应该工作。请报告你的错误

get。


-
http://www.dbForumz.com/ 本文由作者的请求发布

单独检查文章是否符合usenet标准

主题网址: http:/ /www.dbForumz.com/PHP-header-r...ict141549.html

访问主题网址以联系作者(reg.req''d)。举报滥用行为: http://www.dbForumz.com/eform.php ?p = 473240


steve< Us ************ @ dbForumz.com>在消息新闻中写道:< 41 ******** @ news.athenanews.com> ...

" Bob Garbados"写道:

>请原谅我的无知,因为我是一个来自ms的新手。
>背景...
>
>如果我创建一个名为redirect.php的页面,那么它的唯一内容是:
> <?php
>标题(位置:http://www.google.com");
> ?>
>它是否应该重定向到 www.google.com?我无法获得
> header()
>功能重定向。
>
>我想尝试在线预订......客户填写
>出来
> SignUp.php上的联系方式和结算信息。 SignUp.php上的表格
>提交到Confirm.php,我在那里进行验证。
>
>如果输入验证失败,我想重定向回


SignUp.php。

>否则我将在


处理

>之前显示输入以进行确认。命令。也许我?实现这个错误...使用asp
>思考
>对于php实现,但我认为这应该很简单,我


必须

>遗失了什么。
>
>谢谢。



正常的方法是在同一个脚本上处理表单,并且只有在一切正常时才重定向
。原因与后期变量有关,
和人们回到上一页。页面(复杂,但请接受我的话)。
如果你重定向,请确保没有写出任何内容(例如标题
东西,空格等)。它应该工作。请报告你得到的错误。




谢谢...

我没有看到错误信息,只是一个空白页面。我正在我的主机服务器上测试它,因为我没有配置IIS来支持php

但我还没有linux盒子设置了。在php.ini中有什么东西可以配置显示错误信息吗?


让我看看我是否有这个...我必须发布表单上

SignUp.php返回SignUp.php,执行验证,如果所有内容都在
$ b之前通过验证,则重定向到确认页面

$ b< html>标签?


再次感谢。


forgive my ignorance, as I''m new to php coming from a ms background...

If I create a page named redirect.php and it''s only content is:
<?php
header("Location: http://www.google.com");
?>
Should it not redirect to www.google.com? I can''t get the header()
function to redirect.

I''m trying to take an online reservation... the customer fills out
contact and billing info at SignUp.php. The form on SignUp.php
submits to Confirm.php, where I perform validation.

If the input fails validation, I want to redirect back to SignUp.php.
Otherwise I will display the input for confirmation before processing
the order. Maybe I''m implementing this wrong... using asp thinking
for a php implementation, but I think this should be simple and I must
be missing something.

thanks.

解决方案

Bob Garbados wrote:

[...]

If the input fails validation, I want to redirect back to SignUp.php.
Otherwise I will display the input for confirmation before processing
the order. Maybe I''m implementing this wrong... using asp thinking
for a php implementation, but I think this should be simple and I must
be missing something.
Instead of redirecting (do you get any error messages by the way?) why
don''t you re-show the form if it''s not filled in correctly? And now
you''re at it, show the user what''s wrong (e.g.: what he didn''t fill in)
thanks.



HTH,
Sebastian
--
The most likely way for the world to be destroyed,
most experts agree, is by accident.
That''s where we come in; we''re computer professionals.
We cause accidents.
--Nathaniel Borenstein


"Bob Garbados" wrote:

forgive my ignorance, as I?m new to php coming from a ms
background...

If I create a page named redirect.php and it?s only content is:
<?php
header("Location: http://www.google.com");
?>
Should it not redirect to www.google.com? I can?t get the
header()
function to redirect.

I?m trying to take an online reservation... the customer fills
out
contact and billing info at SignUp.php. The form on SignUp.php
submits to Confirm.php, where I perform validation.

If the input fails validation, I want to redirect back to SignUp.php. Otherwise I will display the input for confirmation before processing the order. Maybe I?m implementing this wrong... using asp
thinking
for a php implementation, but I think this should be simple and I must be missing something.

thanks.



The normal way is to process the form on the same script, and redirect
only if everything is ok. The reason has to do with post variables,
and people going back to prev. page (complex but take my word for it).
If you redirect, make sure nothing has been written out (e.g. header
stuff, spaces, etc.). It should work. Please report the error you
get.

--
http://www.dbForumz.com/ This article was posted by author''s request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-header-r...ict141549.html
Visit Topic URL to contact author (reg. req''d). Report abuse: http://www.dbForumz.com/eform.php?p=473240


steve <Us************@dbForumz.com> wrote in message news:<41********@news.athenanews.com>...

"Bob Garbados" wrote:

> forgive my ignorance, as I?m new to php coming from a ms
> background...
>
> If I create a page named redirect.php and it?s only content is:
> <?php
> header("Location: http://www.google.com");
> ?>
> Should it not redirect to www.google.com? I can?t get the
> header()
> function to redirect.
>
> I?m trying to take an online reservation... the customer fills
> out
> contact and billing info at SignUp.php. The form on SignUp.php
> submits to Confirm.php, where I perform validation.
>
> If the input fails validation, I want to redirect back to


SignUp.php.

> Otherwise I will display the input for confirmation before


processing

> the order. Maybe I?m implementing this wrong... using asp
> thinking
> for a php implementation, but I think this should be simple and I


must

> be missing something.
>
> thanks.



The normal way is to process the form on the same script, and redirect
only if everything is ok. The reason has to do with post variables,
and people going back to prev. page (complex but take my word for it).
If you redirect, make sure nothing has been written out (e.g. header
stuff, spaces, etc.). It should work. Please report the error you
get.



Thanks...
I''m not seeing an error message, just a blank page. I''m testing it on
my hoster''s server because I haven''t configured IIS to suppport php
yet and I don''t have a linux box set up yet. Is there something to
configure in php.ini to display error messages?

Let me see if I have this right... I have to post the form on
SignUp.php back to SignUp.php, perform the validation, and redirect to
the confirmation page if everything passes validation prior to the
<html> tag?

thanks again.


这篇关于无法获取header()来重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆