title: Javascript validation not working if i have more than one row
body: <p>The problem i'm facing here is javascript validation not working if there is more than one row. Why doesn't it validate the when there is more than one row?</p>
  
  <p><strong>Javascript</strong></p>
  
  <pre><code>function mstatusvalidate()
  {
      if(document.mstatus.mealstatus.value == "empty")
      {
          alert("Meal status field should not be empty.");
          document.mstatus.mealstatus.focus();
          return false;
      }
      return true;
  }
  </code></pre>
  
  <p><strong>PHP</strong> and <strong>HTML</strong></p>
  
  <pre><code>if( mysql_result($m_result, $i, 'ActiveStatus') != 'empty' )
          {
              if( mysql_result($m_result, $i, 'ActiveStatus') == 'Y' )
              {
                  echo "&lt;td class=green &gt;Active&lt;/td&gt;";
              }
              else if( mysql_result($m_result, $i, 'ActiveStatus') == 'N' )
              {
                  echo "&lt;td class=red &gt;Inactive&lt;/td&gt;";
              }
          }
          else
              {
                  echo "&lt;td&gt;&lt;form name=mstatus method=post onsubmit=return(mstatusvalidate()); action='voucherstatus_update.php?id_meal= " . mysql_result($m_result, $i, 'MealPlanID') . "'&gt;&lt;select name=mealstatus&gt;&lt;option value=empty&gt;&lt;/option&gt;&lt;option value=active&gt;Active&lt;/option&gt;&lt;option value=inactive&gt;Inactive&lt;/option&gt;&lt;/select&gt;&lt;input type=submit class=update_status title=\"Update " . mysql_result($result, $i, 'GuestName') . " meals status\" value=Update&gt;&lt;/form&gt;&lt;/td&gt;";
              }
  </code></pre>
  
  <p>Image of the html combobox form</p>
  
  <p><img src="https://i.stack.imgur.com/7GVIm.png" alt="This is the image"></p>