title: Javascript - How to show message box if any 2 selected dropdown list value are same
body: <p>may I know how to show a message box if any two selected dropdown lists' value are same?</p>
  
  <p>Here's my coding for those dropdown lists:</p>
  
  <pre><code>&lt;form action="checkresult2.php"&gt;
      &lt;table class="p1" bgcolor="#FFFFCC" bordercolor="#000000" align="center" width="771" border="2"&gt;
            &lt;tr&gt;
                &lt;td&gt;&lt;div align="center"&gt;&lt;strong&gt;No.&lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;
                &lt;td&gt;&lt;div align="center"&gt;&lt;strong&gt;Subject Name&lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;
                &lt;td&gt;&lt;div align="center"&gt;&lt;strong&gt;Grade&lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;
            &lt;/tr&gt;
  
            &lt;?php 
            for($i=1; $i&lt;=10; $i++)
            {?&gt;
            &lt;tr&gt;
                &lt;td width="42"&gt;&lt;div align="center"&gt;&lt;?php echo $i; ?&gt;&lt;/div&gt;&lt;/td&gt;
                &lt;td width="539"&gt;
                    &lt;select id="subject_opt" name="subj[]"&gt;
                        &lt;option value=""&gt;--- Please choose a subject ---&lt;/option&gt;
                            &lt;?php
                            $result = mysql_query("SELECT * FROM spm_subject");
                            while($s = mysql_fetch_assoc($result))
                            {?&gt;
                                &lt;option value="&lt;?php echo $s['name']; ?&gt;"&gt;&lt;?php echo $s["name"]; ?&gt;&lt;/option&gt;
                        &lt;?php } ?&gt;
                    &lt;/select&gt;
                &lt;/td&gt;
                &lt;td width="166"&gt;&lt;div align="center"&gt;
                    &lt;select id="grade_opt" name="grad[]"&gt;
                        &lt;option value=""&gt;- Select grade -&lt;/option&gt;
                            &lt;?php
                            $result2 = mysql_query("SELECT * FROM spm_grade");
                            while($g = mysql_fetch_assoc($result2))
                            {?&gt;
                                &lt;option value="&lt;?php echo $g['grade']; ?&gt;"&gt;&lt;?php echo $g["grade"]; ?&gt;&lt;/option&gt;
                        &lt;?php } ?&gt;
                    &lt;/select&gt;
                &lt;/div&gt;
                &lt;/td&gt;
            &lt;/tr&gt;
              &lt;?php }?&gt;
            &lt;tr&gt;
                &lt;td colspan="3"&gt;
                    &lt;div align="center"&gt;
                        &lt;input type="submit" value="Submit"&gt;
                    &lt;/div&gt;
                &lt;/td&gt;
            &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>If:
  <a href="http://i.stack.imgur.com/NqMsW.png" rel="nofollow">Dropdown lists</a><br>
  Then there will be a message box shown and tell me there are duplicate value cannot be same. Anyone can share ideas for me? Thanks.</p>