You are here: Re: How to redirect after form submit? « PHP Programming Language « IT news, forums, messages
Re: How to redirect after form submit?

Posted by deko on 06/12/06 22:07

> 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>

Thanks, that helped. I am getting the correct redirect behavior now.

But I still have a couple of questions...

Here's how it looks now:

------------------------
<?php
$message = $_POST['message'];
$email = $_POST['email_address'];
if (!empty($message) && !empty($email))
{
header("Location:http://bubba/send-confirm.php");
exit;
}
?>
DOCTYPE
<html>
....
....
<form action=<?php include "myscript.php" ?> method="POST">
<input name="email_address" type="text" size="10" maxlength="255">
<textarea name'"message" rows="12" cols="22"> </textarea>
<input type="submit" value="Send">
</form>
....
....
</html>
--------------------------

Does my form look correct?

What form attributes are required (which are optional) - name, type, method... ?

Am I properly referencing "myscript.php"? Do I need the include statement?

Thanks again for you help!

 

Navigation:

[Reply to this 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

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