title: How can i get value from selection box in javascript?
body: <pre><code>                                &lt;table border="1"&gt;
                                      &lt;tr&gt;
                                          &lt;th&gt;
                                              SR No.&lt;br /&gt;
                                          &lt;/th&gt;
                                          &lt;th&gt;
                                              Name
                                          &lt;/th&gt;
                                          &lt;th&gt;
                                              Address
                                          &lt;/th&gt;
                                          &lt;th&gt;
                                              Area
                                          &lt;/th&gt;
                                          &lt;th&gt;
                                              City
                                          &lt;/th&gt;
                                          &lt;th&gt;
                                              Contact No.
                                          &lt;/th&gt;
                                          &lt;th&gt;
                                              Volunteer List
                                          &lt;/th&gt;
                                          &lt;th&gt;
                                              Bird Namea
                                          &lt;/th&gt;
                                          &lt;th&gt;
                                              Status
                                          &lt;/th&gt;
                                          &lt;th&gt;
                                              Send SMS
                                          &lt;/th&gt;
                                      &lt;/tr&gt;
                                      &lt;?php
                                          while($row = mysql_fetch_array($pager-&gt;result))
                                          {
                                      ?&gt;
                                      &lt;tr&gt;
                                          &lt;td&gt;
                                              &lt;?php echo $row['InqID']; ?&gt;
                                          &lt;/td&gt;
                                          &lt;td&gt;
                                              &lt;?php echo $row['InqFromName']; ?&gt;
                                          &lt;/td&gt;
                                          &lt;td&gt;
                                              &lt;?php echo $row['InqFromAddress']; ?&gt;
                                          &lt;/td&gt;
                                          &lt;td&gt;
                                              &lt;?php echo $row['InqArea']; ?&gt;
                                          &lt;/td&gt;
                                          &lt;td&gt;
                                              &lt;?php echo $row['InqCity']; ?&gt;
                                          &lt;/td&gt;
                                          &lt;td&gt;
                                              &lt;?php echo $row['InqContactNo']; ?&gt;
                                          &lt;/td&gt;
                                          &lt;td&gt;
                                          &lt;select name="volunteerSelect1" id="volunteerSelect1"&gt;
                                              &lt;option value="" selected="selected"&gt;Please Select Volunteer&lt;/option&gt;
                                              &lt;?php
                                                  $select="SELECT * FROM tran_ngovolent where ngovolentNGOCode=".$ngoSelectId;
                                                  //echo $select;
                                                  $result=mysql_query($select);
                                                  while($rowBird=mysql_fetch_array($result))
                                                  {
                                                      echo"&lt;option value=".$rowBird['ngovolentMobile']." id='volmobile'&gt;".$rowBird['ngovolentName']."&lt;/option&gt;";
                                                  }
                                              ?&gt;
                                          &lt;/select&gt;
                                          &lt;/td&gt;
                                          &lt;td&gt;
                                              &lt;?php 
                                                  $birdID=$row['InqBirdType'];
                                                  $birdSelect="SELECT Bird_Name FROM mst_bird WHERE Bird_Code=".$birdID;
                                                  $result=mysql_query($birdSelect);
                                                  while($bird_name=mysql_fetch_array($result))
                                                  {
                                                      $birdname=$bird_name['Bird_Name'];
                                                      echo $birdname;
                                                  }
                                              ?&gt;
                                          &lt;/td&gt;
                                          &lt;td&gt;
                                              &lt;?php
                                                  $inqStatus=$row['InqStatus'];
                                                  if($inqStatus==0)
                                                  {
                                                      echo "&lt;a href='index.php?id=".$row['InqID']."&amp;status=status&amp;page=".$pageid."' onclick='return confirmAction()'&gt;Pending&lt;/a&gt;";
  
                                                  }else
                                                  {
                                                      echo "Finished";
                                                  }
                                              ?&gt;
                                          &lt;/td&gt;
                                          &lt;td&gt;
                                              &lt;input type="button" name="SendSMS" value="Send SMS" onclick="smsNgo(&lt;?php echo $birdID;?&gt;,&lt;?php echo "'".$row['InqFromAddress']."'";?&gt;,&lt;?php echo "'".$birdname."'";?&gt;,&lt;?php echo "'".$row['InqCity']."'";?&gt;,&lt;?php echo "'".$row['InqArea']."'";?&gt;,&lt;?php echo "'".$row['InqFromName']."'";?&gt;,&lt;?php echo "'".$row['InqContactNo']."'";?&gt;);return sms()"/&gt; 
                                          &lt;/td&gt;
                                      &lt;/tr&gt;
                                      &lt;?php
                                          }
                                      ?&gt;
                                      &lt;tr&gt;
                                          &lt;td colspan="10"&gt;
                                             &lt;?php echo $pager-&gt;show(); ?&gt;
                                          &lt;/td&gt;
                                      &lt;/tr&gt;      
                                  &lt;/table&gt;
  </code></pre>
  
  <p>In this Program i get value from database in my selection box. show this image
  <img src="https://i.stack.imgur.com/c2Uk1.png" alt="enter image description here"></p>
  
  <p>In first selection box i got perfect out put in my JavaScript but other one selection box value is null or empty Here is my JavaScript and Ajax code.</p>
  
  <pre><code>function smsNgo(birdno,address,birdname,city,area,name,contact)
  {
  //document.write(mobile1);  
  var ngocontact = document.getElementById("volunteerSelect1").value;
  //var ngocontact = selectElement.options[selectElement.selectedIndex].value;
  
  var xmlhttp;
  if (window.XMLHttpRequest)
   {// code for IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp=new XMLHttpRequest();
    }
  else
    {// code for IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  xmlhttp.onreadystatechange=function()
    {
    if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200)
     {
          //document.getElementById("smsStatus").innerHTML=xmlhttp.responseText;; 
      window.open("http://localhost/goal_bird/admin/edit.php","_self");
  
     }
    }
   var url="http://www.****.co.in/sendsms.aspx?mobile=******&amp;pass=******&amp;    senderid=SMSIdea&amp;to="+ngocontact+"&amp;msg=Bird id is "+birdno+" "+birdname+" "+name+"     "+address+" "+area+" "+city+" "+contact;
  document.write(url);
  xmlhttp.open("POST",url,true);
  xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
  xmlhttp.send();
  setTimeout("location.href='index.php'",2000);
  }
  </code></pre>