Reply to Re: How to redirect after form submit?

Your name:

Reply:


Posted by David Haynes on 06/12/06 16:07

deko wrote:
>> You must ensure that there is no blank space or empty lines, outside
>> of the <?php ?> braces. Any such empty space will be sent and will
>> cause headers to already be sent.
>>
>> Make sure that <?php is the very first thing on the very first line of
>> the file.
>
> but what about all the html?
>
> the page looks like this:
>
> DOCTYPE ...
> <html>
> <head>
> ...
> javascript...
> </head>
> <body>
> <html>
> all kinds of html...
> <form>
> <?php
> ...
> ?>
> ...
> </form>
> more html...
> </html>
> </body>
>
> I want the redirect to happen only if the form is filled out correctly,
> so the redirect should, I think, go just after the form code.
>
>
The form processing should be the *first* thing in the file.
Something like:

DOCTYPE ...
<?php
if( isset($_POST['foo'] ) {
// do form processing

if( $isValid ) {
header();
exit;
}
}
?>
<form action="..." method="POST">
....
<input type="text" name="foo" size="10" maxlength="255">
<input type="submit">
</form>

-david-

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация