Reply to Re: How to redirect after form submit?

Your name:

Reply:


Posted by deko on 06/13/06 01:22

This seems to be working...

This goes at the top of the page, before any other header info is sent:

$message = $_POST['message'];
$email = $_POST['email_address'];
if (!empty($message) && !empty($email))
{
header("Location:http://www.mysite.com/send-confirm.php");
mail("me @ mysite.com", "Feedback Form", $message, "From: $email");
exit;
}

This form can go anywhere in the page:

<form action="" method="post" name="feedback">
<input name="email_address" type="text" size="30" maxlength="255" /><br />
<textarea name="message" rows="12" cols="22" maxlength="4096"></textarea>
<input type="submit" value="Send">
</form>

Note that the form action is: ""

I have not tested this fully yet - it works writing the message to a file (as in
my previous example), but I don't know if it will send the message as an email.

The goal of this exersize was simply to redirect the user to a confirmation page
after successfully sending a message via an in-page feedback form on my web
site.

[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

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