Link to home
Start Free TrialLog in
Avatar of Robert Granlund
Robert GranlundFlag for United States of America

asked on

PHP Clear Mail Form after submit

Is there a simple way to clear a mail form upon submit?
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

What is the issue here?  Can you please explain a little more?  Thanks, ~Ray
Huh?  The page should be getting refreshed with a blank form or a thank you page should be going back.


Cd&
@CobolDino:  Agreed.  Maybe autocomplete="off" ?  I am wondering if the question goes to the nature of the browser back button, and the risk of accidental duplicate form submissions?  But it is impossible to know without some clarifying input from the Author.

Best regards, ~Ray
Ray,

All I can do is send back an initialized form or a response page.  On the server I can prevent duplicate submissions with entries in the session. Browser side, I can't control the browser or the user; and I don't want to.  If there is ignorance it can be remedied with education.  If it is stupidity, there is no cure.

Cd&
If it is stupidity, there is no cure.

Ha!  Agreed, indeed!  Reminds me of the legendary oil well firefighter Red Adair who famously said, "If you think it's expensive to hire a professional, just wait till you hire an amateur,"
Avatar of Robert Granlund

ASKER

On a page I have a number of ID's.  Using jquery, when you click a menu choice the page "slides" to the clicked ID. On of the IDS corresponds to a 'Contact Us' Form. On the contact Us Page/ID I have used the following: <form action="<?php echo $_SERVER['PHP_SELF'] ?>#contact" method="post">

After the email has been sent there is a "success" message displayed.  However, when you use the menu to jump to another part of the page, the form re-submits.  So, is there a way, a piece of code that will auto clear the form after the email has been successfully sent?

Also, in the form, I have made the values sticky if that matters.
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial