well, the usual way you do something like this is:
1.) you have a form with some fields, say 'myform.php'
2.) the action attribute of the form tag points to 'myform.php'. so when you submit the form the same php-script gets called.
3.) in your script you check if the http request is GET or POST ($_SERVER['REQUEST_METHOD']). if it is a POST you have to validate all the fields. if the validation fails, you display an error message and output the values the user has entered again in the form. if the entered data is valid you insert them into your database and after that you do a redirect to the page that lists all the entries.
This way you don't have to "cache" anything somewhere.