Reply to Re: Avoiding double-submissions with mail script

Your name:

Reply:


Posted by Jim Dornbos on 02/01/06 20:43

On 1 Feb 2006 09:49:44 -0800, "Chuck W." <cwyatt@w3minds.com> wrote:

>So I have a very simple mail script just to send a quick 'n dirty
>notification of a form posting -- it goes like this:

>$message = $_POST["salutation"] . "\", first_name = \"".
>$_POST["first_name"] . "\",last_name = \"". $_POST["last_name"] .
>"\",title = \"" . $_POST["title"] . "\", company = \"" .
>$_POST["company"] . "\", leadsource = \"" . $_POST["lead_source"] ;
>
>$headers .= 'From: Sender <sender@blahblah.com>' . "\r\n";
>$subject = 'New record notification';
>$to = 'recipient@blahblah.com';
>
>// Mail it
>mail($to, $subject, $message, $headers);
>
>So I'm wondering how can I code this thing so when someone hits the
>submit button on the form twice it doesn't send two email messages (or
>more)? Wrap a session variable around it somehow?

From one newb to another... in addtion to mailing the message, I would
unset a couple of (all?) your $_POST values. Then add some code prior
to mailing to make sure they have values. Hitting submit once would
send the message. Hitting submit a second time would throw up your
error message about missing values (because you just wiped them out.)

Jim

[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

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