Email not clearing after success

I’ve followed the cookbook and email set instructions but I have a question.

Am I right in thinking that this statement inside the controller is supposed to clear the data from the form?

// no exception occured, let's send a success message
if (empty($alert) === true) {
    $success = 'Your message has been sent, thank you. We will get back to you soon!';
    $data = [];

Because when I refresh the page or update one of my .php files and browsersync reloads the page - I end up getting duplicate emails.

The best strategy is always to reroute to another page after success, that way resending of the form is avoided.

Quick and dirty example for me please.


or something like that on success

1 Like