title: Updating Records TV Show database - PHP MYSQL
body: <p>I'm trying to create a backpanel to my TV project. My MySql database consists of two tables. "Shows" &amp; "Seasons". </p>
  
  <p>The Shows table consists of the Show ID (Primary Key), Show Title &amp; date. The Seasons table consists of Season ID (Primary Key), Show ID (Foreign Key), Season, release date. </p>
  
  <p>The first thing you see in the control panel is all the shows from the database in table format. For instance if you edit "Dexter" it will bring you to the edit page showing input boxes for the seasons of dexter. Like Season 1,Season 2 etc... I have this sort of working. By that i mean it displays properly in input boxes but when i go to submit it just redirects back to the same edit page and nothing gets updated.</p>
  
  <p>The Code from my main index.php backpanel that allows you to edit:</p>
  
  <pre><code>&lt;td&gt;&lt;a href="edit.php?id=&lt;?php echo $row['show_id']; ?&gt;"&gt;edit&lt;/a&gt;&lt;/td&gt;
  </code></pre>
  
  <p>Code from edit.php:</p>
  
  <pre><code>&lt;?php
  $playlist_id=$_GET['id'];
  // this makes it so it grabs the season records that match the show id
  $sql="SELECT * FROM seasons WHERE show_id='$show_id'";
  $result=mysql_query($sql);
  $count=mysql_num_rows($result);
  ?&gt;
  
  
  
  &lt;table&gt;
  &lt;form name="form1" method="post" action=""&gt;
  &lt;tr&gt;
  &lt;td&gt;
  &lt;table&gt;
  &lt;tr&gt;
  &lt;td align="center"&gt;&lt;strong&gt;Id&lt;/strong&gt;&lt;/td&gt;
  &lt;td align="center"&gt;&lt;strong&gt;Season Name&lt;/strong&gt;&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;?php
  while($rows=mysql_fetch_array($result)){
  ?&gt;
  
  &lt;tr&gt;
  &lt;td align="center"&gt;
  &lt;input name="season_id[]" type="text" id="season_id" value="&lt;?php echo $rows['season_id']; ?&gt;"&gt;
  &lt;/td&gt;
  &lt;td align="center"&gt;
  &lt;input name="Season[]" type="text" id="Season" value="&lt;?php echo $rows['Season']; ?&gt;"&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;?php
  }
  ?&gt;
  
  &lt;tr&gt;
  &lt;td&gt;&lt;/td&gt;
  &lt;td&gt;&lt;/td&gt;
  &lt;td colspan="4" align="right"&gt;&lt;input type="Submit" name="Submit" value="Submit"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;/form&gt;
  &lt;/table&gt;
  
  &lt;?php
  
  $result1 = FALSE;
  if (isset($_GET['Submit'])) {
  for($i=0;$i&lt;$count;$i++){
  $sql1="UPDATE seasons SET Season='$Season[$i] WHERE Season_id='$Season_id[$i]'";
  $result1=mysql_query($sql1);
  }
  }
  
  if($result1){
  header("location:update.php");
  }
  mysql_close();
  ?&gt;
  </code></pre>
  
  <p>You are probably wondering why would i want to edit the name of the seasons but i will eventually make it more complicated and add more fields once i get past this hurdle. Like i said it displays properly but when i hit submit it just reloads the page and nothing changes. </p>