Re: formbuilder: where do you put a redirect statement to redirect you to another page after processing?
| From: | Justin Patrin | Date: | Wed, 05 Jan 2005 18:53:01 +0000 |
| Subject: | Re: formbuilder: where do you put a redirect statement to redirect you to another page after processing? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-16672@lists.php.net to get a copy of this message | ||
On Wed, 5 Jan 2005 07:55:41 -0800 (PST), l Burnerheimerton
<lburnerheimerton@yahoo.com> wrote:
> I've tried in the form that calls the dataobject page, in preprocess and postprocess
> functions and none work. They all throw the error "Cannot modify header information - headers
> already sent by..."
>
> My page has some html in it before the php code for formbuilder. If I take that out it works
> but I need that in to format the page properly.
>
> If I can't have that in, I might just scrap using FormBuilder.
Grrr. header() is one way to redirect. If you must output before the
validation and processing, use a meta refresh or javascript to
redirect. Redirecting has *nothing* to do with FormBuilder.
Try this:
function redirect($url) {
if ((!stristr($_SERVER['HTTP_USER_AGENT'], 'MSIE') ||
!stristr($_SERVER['HTTP_USER_AGENT'], 'Mac')) && !headers_sent()) {
header('Location: '.$url);
}
echo '<script language="JavaScript1.1">
<!--
location.replace("'.$url.'");
//-->
</script>
<noscript>
<meta http-equiv="Refresh" content="0; URL='.$url.'"/>
</noscript>
This page has moved to a <a href="'.$url.'">new location</a>.
';
}
>
> Thanks for any ideas
>
--
Justin Patrin