if( strtoupper( $_SERVER['HTTP_REQUEST_METHOD'] ) == "POST" ) { // Insertas a tu base de datos} else { // Despliegas el formulario}