Hi all, I've got a question that I'm sure can be answered, but I'm a little stuck right now...
I've set up yelvington's excellent annotate script, and it works beautifully. My next step was to try to add an auto email function to notify me when someone has posted a comment, and send me the entire question list. (I'll be using this for client feedback) Everything works extremely peachy, EXCEPT the mail gets posted on every page update, not just on the button press. So the question is... is there a way to create this feature that only occurs when the submit button is pressed? Below is the code in it's entirety, with this code: <?require($DOCUMENT_ROOT . "/annotate.php3"); ?> being placed in the html document. Thanks a million in advance. (btw, if you do choose to answer this, cc me as well, as I'm on digest.) Jeff /***************************************/ <?PHP if ($message) { $message = ereg_replace("\r\n\r\n", "\n<P>", $message); $date = date("l, F j Y, h:i a"); $message = "<B>$name </B> -- $date<P> $message <BR><HR>"; $fp = fopen (basename($PHP_SELF) . ".comment", "a"); fwrite ($fp, $message); fclose ($fp); } @readfile(basename(($PHP_SELF . ".comment"))); // function to open a file and place the file into //a buffer for further processing function open_template($template_file) { $i; $output; $temp = file($template_file); for ($i=0; $i<count($temp); $i++) { $output .= $temp[$i]; } return $output; } //open the file $buffer = open_template(basename($PHP_SELF) . ".comment"); //do some text processing so the email gets plain text, rather //than html formatted text //replace html rules with returns $buffer = str_replace("<HR>", chr(10), $buffer); //replace html breaks with returns $buffer = str_replace("<BR>", chr(10), $buffer); //strip all other html tags $buffer = strip_tags($buffer); //email away... mail("[EMAIL PROTECTED]", "Auto Form Reply", $buffer); ?> <FORM method="post"> <b>Your name:</b><BR><INPUT name="name" type="text" size="55"><BR> <b>Your comment:</b><BR><TEXTAREA name="message" rows=10 cols=55 wrap=virtual> </TEXTAREA><BR> <INPUT name="submit" type="submit" value="Post your comments"> </FORM> -- ___________________________________ Jeff Kryvicky Collider, Inc. [motion graphics for the masses] 133 W 19th St 5th Floor NYC 10011 Tel 646 336 9398 Fax 646 349 4159 Email [EMAIL PROTECTED] Site http://www.collidernyc.com ___________________________________