选择禁用未将选定值传递给php代码[重复]

This question already has an answer here:

I am having a one page activity code, where I can submit a new data and fetch the previous data on the same page. Whenever i fetch the data i mark select disable by js code. But the fetched data will not submitted to database, because it is disabled. I want to save the data of disabled dropdown.

 <input type="hidden" name='same_as_select' value=""/>

JS Code :

 function getData(val)
 {
 var myLength = $("#mob_1").val();
 $.ajax({
 type: "POST",
 url: "test.php",
 dataType: "json",
 data:'dt='+val,
 success: function(data){
    console.log(data);
 var len = data.length;
 if(len > 0){
   var id12 = data[0]['id12'];
   var id13 = data[0]['id13'];
   document.getElementById('category').value = id12;
   document.getElementById('source').value = id13;
   if(id13!='DID NOT PROVIDE')
   {
    $('#source').attr("disabled", "disabled").value; 
    $('#category').attr("disabled", "disabled").value; 
    }
   else
    {
    $('#source').removeAttr("disabled"); 
    $('#category').removeAttr("disabled");
    document.getElementById('category').value = '';
    document.getElementById('source').value = '';
    }
   }
   }
   });
   }

HTML:

 <input type="number" name="mob_1" ID='mob_1' value="" onchange="getData(this.value);" />
 <select name="category" id="category">
 <option value="" class="1">--SELECT--</option>
 <option value="NEWSPAPER">NEWSPAPER</option>
 <option value="ONLINE">ONLINE</option>
 </select>  
 <select name="source" id="category">
 <option value="" class="1">--SELECT--</option>
  //THIS SOURCE COMING FROM DATABASE BY CATEGORY SELECTION
 </select>                              

In php query it shows category='',source='' because it is disabled

</div>

First of all, you have two different elements with the same ID (category) - fix it.

Second, to get the data from the disabled selection boxes use the following (here is example for the category selection):

var categorySelection= document.getElementById('category')
var categoryValue = categorySelection.options[categorySelection.selectedIndex].value;

and use categoryValue where you need to.