With the code I posted, you will need to check whether the $_POST superglobal is set (has the form been submitted), if so then process the code, if not, do nothing and load the page as usual.

Regards,

NM.