On Wed, 2003-09-24 at 16:22, Martin Raychev wrote:
> Hi!
> 
> I am kind of newbie coming from ASP and I came upon some hindrances, which
> could be because of not knowing enough of PHP
> 
> The problem is:
> I am trying to make a form with good and user-friendly validation. After
> failure to validate properly some of the fields and going to another page
> i.e. the <form action="anotherpage.php"> I need to go back to the previos
> page where the form is.
> In ASP I would use Response.Redirect and that's it but the
> 
> header (Location...) in PHP is said that it must be on top of the HTML page
> before anything else. This doesn't seems to work for me.
> 
> Does anyone has a solution to this problem?

A simple, ignore the real problem, solution is to turn on output
buffering. The real problem is that you probably have output occuring
before the validation occurs, which is why you can't redirect. Solving
this will prevent the need for output buffering. Another solution is,
once you detect an error, to output a javascript redirect. This is
probably the dirtiest IMHO.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to