title: refresh data after $_POST on same page
body: <p>I have a page with a  who does a post to the same page. I want that page to be refreshed with new data after a succesful database INSERT.</p>
  
  <p>Let me add some code.</p>
  
  <p><strong>default.php</strong></p>
  
  <pre><code>&lt;?php
  session_start();
  require("dbconfig.php");
  include("head.php");
  
  //if user is not signed in, redirect to login page
  if (!isset($_SESSION['sess_user']) ) {
     header ("Location: login.php");
     exit;
   }
  
  ?&gt;
  
  &lt;body&gt;
  
  &lt;div id="menu"&gt;
    &lt;?php
       include("menu.php"); //include the menu
    ?&gt;
  
  &lt;/div&gt;
  &lt;div id="page_content"&gt;
     &lt;?php 
      include ($p); //Include selection from menu.php
     ?&gt;
  &lt;/div&gt;
  ?&gt;
  </code></pre>
  
  <p><strong>dbconfig.php</strong></p>
  
  <pre><code>&lt;?php 
  DEFINE ('DB_USER', 'someuser');  
  DEFINE ('DB_PASSWORD', 'somepassword');  
  DEFINE ('DB_HOST', 'localhost');  
  DEFINE ('DB_NAME', 'somedatabase'); 
  
  $connection = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or 
  die('Connection to the specified database couldn\'t be established');  
  mysql_select_db(DB_NAME)  or 
  die ('Specified database couldn\'t be selected');
  
  function db_escape ($post)
  {
  if (is_string($post) ) {
      if (get_magic_quotes_gpc() ) {
          $post = stripslashes($post);
      }
      return mysql_real_escape_string ($post);
  }
  foreach ($post as $key =&gt; $val) {
      $post [$key] = db_escape($val);
  }
  return $post;
  }
  ?&gt;
  </code></pre>
  
  <p><strong>page/cities.php</strong></p>
  
  <pre><code>&lt;?php 
  //if not signed in correctly, redirect to login page
  session_start();
  if (!isset($_SESSION['sess_user']) ) {
      header ("Location: login.php");
      exit;
  }
  ?&gt;
  &lt;h2&gt;Available cities&lt;/h2&gt;
  &lt;?php
  //List all available cities from database
  $cities_query = "SELECT city_name FROM city_selection";
  $cities_result = mysql_query($cities_query);
  
      while ($row = mysql_fetch_assoc($cities_result)) {
          echo $row['city_name'] . "&lt;br /&gt;";
          }
  ?&gt;
  &lt;?php
  //Add new city to list
  if(isset($_POST['submit'])){
  
      $city_name = $_POST['city_name'];
      $query="INSERT into city_selection (city_name) values ('$city_name')";
      $result = mysql_query($query);
  }
   ?&gt;
  &lt;hr&gt;
  &lt;h2&gt;Add new city&lt;/h2&gt;
  &lt;form method="post" action="default.php?p=settings_cities"&gt;
  Namn: &lt;input type="text" name="city_name"&gt;
  &lt;input type="submit" name="submit" value="Add city"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>This code may not be pretty but it works. It succesfully adds a new record to the database however I want the page/cities.php to be refreshed with my ny record after the post. Is this possible? </p>
  
  <p>Let me add that this i my first ever php page. I've only read some books so don't bash me for beeing a bad programmer :)</p>