title: Why the value from mysql database is not set as "selected" in the dropdown in PHP
body: <p>This does not reflect the data that's on the database. I don't know why, but the other dropdowns work properly except this. This one has 2 conditions for the WHERE clause that is working. The one that's not working is the selection of the data according to that one saved in the database. Again, I also have other 2 dropdowns which is these that's working..</p>
  
  <pre><code>&lt;font&gt; Course/Year/Section&lt;/font&gt;
  
  &lt;?php
  $sqlA = "SELECT Course FROM tblcys";
  $resultA = mysql_query($sqlA);
  
  echo "&lt;select name='Course' required&gt;";
  echo "&lt;option value=''&gt;Select Course&lt;/option&gt;";
  while ($rw = mysql_fetch_array($resultA)) { ?&gt;
      &lt;option value="&lt;?php echo $rw['Course']; ?&gt;"&lt;?php if($rw['Course']==$Course) echo 'selected="selected"'; ?&gt;&gt;&lt;?php echo $rw['Course']; ?&gt;&lt;/option&gt;
      &lt;?php
  }
  echo "&lt;/select&gt;" ?&gt;
  
  &lt;?php
  $sqlB = "SELECT Year FROM tblcys WHERE Course ='". $Course. "' ORDER BY Year ASC";
  $resultB = mysql_query($sqlB);
  
  echo "&lt;select name='Year' required&gt;";
  echo "&lt;option value=''&gt;Select Year&lt;/option&gt;";
  while ($rw1 = mysql_fetch_array($resultB)) { ?&gt;
      &lt;option value="&lt;?php echo $rw1['Year']; ?&gt;"&lt;?php if($rw1['Year']==$Year) echo 'selected="selected"'; ?&gt;&gt;&lt;?php echo $rw1['Year']; ?&gt;&lt;/option&gt;
      &lt;?php
  }
  </code></pre>
  
  <p>This one is the one that's not working</p>
  
  <pre><code>&lt;?php
  $sqlC = "SELECT Section FROM tblcys WHERE tblcys.Course ='". $Course. "' AND tblcys.Year ='". $Year. "' ORDER BY Section ASC";
  $resultC = mysql_query($sqlC);
  
  echo "&lt;select name='Section' required&gt;";
  echo "&lt;option value=''&gt;Select Section&lt;/option&gt;";
  while ($rw2 = mysql_fetch_array($resultC)) { ?&gt;
      &lt;option value="&lt;?php echo $rw2['Section']; ?&gt;"&lt;?php if($rw2['Section']==$Section) echo 'selected="selected"'; ?&gt;&gt;&lt;?php echo $rw2['Section']; ?&gt;&lt;/option&gt;
      &lt;?php
  }
  echo "&lt;/select&gt;" ?&gt;
  </code></pre>
  
  <p>These are the other details about the variables being passed on.</p>
  
  <pre><code>$result2=mysql_query("Select * From tblrecord where studID='$ID'");
  while($row=mysql_fetch_array($result2))
  {
  
  $RFIDNo=$row['RFIDNo'];
  $studID=$row['studID'];
  $lname=$row['lname'];
  $fname=$row['fname'];
  $mi=$row['mi'];
  $Course=$row['Course'];
  $Year=$row['Year'];
  $Section=$row['Section'];
  $Section=$row['Status'];
  }
  </code></pre>