title: keep value in textbox after page reload to itself in php?
body: <p>I have two textboxes and two dropdowns in a form. After filling values in textboxes and selecting value from dropdown the page reloads and based on value selected in dropdown other dropdown gets populated. But values in textboxes is not there. How to retain these textboxes values.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form action="selectmultiplepost.php" method="post" name="myform"&gt;
  
  First Name&lt;input type="text" name="firstname" value=""&gt;&lt;br&gt;
  Last Name&lt;input type="text" name="lastname" value=""&gt;&lt;br&gt;
  
  
  Industry Name &lt;select name="industryid" id="industrySelect" onchange="document.location.href = 'selectmultiple.php?industryid=' + this.value"&gt;
  &lt;option&gt;SELECT&lt;/option&gt;
  &lt;?php
  include('config.php');
  
  $query = "select IndustryId, IndustryName from industrytable";
  $result = mysql_query($query);
  if(mysql_num_rows($result) &gt; 0)
  {
      while($fetch = mysql_fetch_array($result))
      {
          ?&gt;
          &lt;option value="&lt;?php echo $fetch['IndustryId'];?&gt;"&gt;&lt;?php echo $fetch['IndustryName'];?&gt;&lt;/option&gt;
          &lt;?php
      }
  }
  
  
  ?&gt;
  &lt;/select&gt;&lt;br&gt;
  Skills &lt;select name="skillname"&gt;
  &lt;option&gt;SELECT&lt;/option&gt;
  &lt;?php
  include('config.php');
  
  if(isset($_GET['industryid']))
  {
  $industryID = $_GET['industryid'];
  }
  else
  {
  $industryID = "";
  }
  
  $skillQuery = "select SkillId, SkillName from skilltable where Industryid='".$industryID."'";
  $resultSkill = mysql_query($skillQuery);
  if(mysql_num_rows($resultSkill) &gt; 0)
  {
      while($fetch = mysql_fetch_array($resultSkill))
      {
          ?&gt;
          &lt;option value="&lt;?php echo $fetch['SkillId'];?&gt;"&gt;&lt;?php echo $fetch['SkillName'];?&gt;&lt;/option&gt;
          &lt;?php
      }
  }
  
  ?&gt;
  
  &lt;/select&gt;&lt;br&gt;
  &lt;input type="submit" name="submitform" value="submit"/&gt;
  &lt;/form&gt;
  
  &lt;script&gt;
  
  document.getElementById('industrySelect').value = "&lt;?php echo $_GET['industryid'];?&gt;";
  &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>