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