in reply to [Solved]: How to perform different actions before and after submit button is clicked.

To get the value of a form input you need to give it a name, so change your button to:
<input type="submit" name="button1" value="Submit" />
Then you can see if it was clicked:
print '<html><head><title>Test</title></head><body>'; if ( $query->param('button1') ) { print 'Thank you - your form was submitted correctly!'; } else { print '<form method="post"><input type="submit" name="button1" val +ue="Submit"></form>'; } print '</body></html>';