title: php array working with mysql database?
body: <p>I'm still pretty new to php and mysql, I've build a basic CMS for my news articles and events etc on my site and I need a button that will add a new year category.</p>
  
  <p>I currently have a form button for 2011 articles so when a user clicks it my news page will get the value 2011 which is hidden and only show articles with the year 2011.</p>
  
  <p>I was thinking of maybe using an array so that when I click add new category it just adds 1 to the year 2011 and I can grab the array values and use them some how to add to where I store my hidden form value when I generate a second form / third .... etc.</p>
  
  <p>I hope that makes sense, if anyone knows an easier way to do this I'm open to ideas. heres the code I use currently</p>
  
  <hr>
  
  <p>news.php</p>
  
  <pre><code>&lt;form action="all-news.php" method="POST" name="editform"&gt;
      &lt;input type="hidden" name="category" value="2013"/&gt;
      &lt;input type="hidden" name="item" value="1"/&gt;
      &lt;input type="submit" style="padding: 2px 15px;background-color:#C00; color:#FFF; margin:10px; font-size:18px; font-family:'Trebuchet MS', Arial, Helvetica, sans-serif" name="go" value="News Articles 2013"&gt;
      &lt;/form&gt;
  </code></pre>
  
  <hr>
  
  <p>newslist.php</p>
  
  <pre><code>    $category = $_POST['category'];
  
          $query = "SELECT * FROM sitecontent WHERE $category = Post_Year ORDER BY Date DESC";
          $result = mysql_query($query);
  
          while($posts = mysql_fetch_array($result)){
              echo "&lt;div&gt;";
              echo "&lt;h3&gt;", $posts['Post_Title'], "&lt;/h3&gt;", "&lt;br/&gt;";
              echo "&lt;a href=\"delete.php?id=$posts[ID]\"&gt; ", "&lt;span style=\"cursor:pointer; padding: 2px 8px;background-color:#C00; color:#FFF; margin-right:10px;\"&gt;" , "Delete", "&lt;/span&gt;" , "&lt;/a&gt;";
              echo "&lt;a href=\"edit.php?id=$posts[ID]\"&gt; ", "&lt;span style=\"cursor:pointer; padding: 2px 8px;background-color:#C00; color:#FFF; margin-right:10px;\"&gt;" , "Edit", "&lt;/span&gt;" , "&lt;/a&gt;";
              echo "&lt;/div&gt;&lt;br/&gt;";
  
          }
  </code></pre>