An option is to keep the user on the same page. So your form is shown by insert.php and it also submits to insert.php. By check if the form is submitted you can do the insert, show a message and let the page show the form as it would do if there was no submission (ie first page view).

php9 wrote:An option is to keep the user on the same page. So your form is shown by insert.php and it also submits to insert.php. By check if the form is submitted you can do the insert, show a message and let the page show the form as it would do if there was no submission (ie first page view).

yes, you can tell if you're responding to a form by just verifying $_POST...

but technically even though it's redirecting to itself, the visitor is still leaving the page. If you wanted to really keep the user on the same page, you would have to use something like ajax to interact with the database. w3schools has a lot of primers and lessons on ajax at http://www.w3schools.com/ajax/default.asp that should be able to get you going in no time.