title: PHP Insert into database not working
body: <p>Greetings I made the following php script so that I could edit text and it would save to a db for future use. However I'm hitting a slight snag at the  update / insert queries. I'm not sure what I'm doing wrong but only one of the commands will execute. I'm not sure if this is a hosting issue or am I doing something wrong. </p>
  
  <p>Any ideas?</p>
  
  <pre><code>if (isset($_SESSION["logged"]) &amp;&amp; $_SESSION["logged"]==1){  
      if ($_POST['action']=="edit"){
          $query=mysql_query("select * from page where active=1 AND heading='".$_POST['selectedpage']."'");
          $row = mysql_fetch_array($query, MYSQL_ASSOC);
  
          echo "&lt;h1&gt;HTML Editor &lt;/h1&gt;&lt;br&gt;";
          echo "&lt;form name='saveform' action='./action.php'  method='post'&gt;";
          echo "&lt;textarea rows='100' cols='100' name='updateBox'&gt;".$row['content']."&lt;/textarea&gt;";
          echo "&lt;br&gt;&lt;input name='action' type='submit' value='save edit'&gt;";
          echo "&lt;input name='heading' type='hidden' value='".$row['heading']."'&gt;";
          echo "&lt;/form&gt;";
      } else if($_POST['action']=="save edit"){
          $query=mysql_query("UPDATE page SET active='0' where heading='".$_POST['heading']."'");
          $query=mysql_query("INSERT into page(heading,content,active) values('".$_POST['heading']."','".$_POST['updateBox']."','1')");
          echo "&lt;p&gt;Changes saved succesfully!&lt;/p&gt;";
          echo "$_POST['updateBox']";
      }
  }
  </code></pre>