Reputation: 527
file1.php
<select class="combo-boxs" name="doc_level" id="combo_doc">
<option value="-">Choose Document Level</option>
<?php
$t=mysql_query("select * from dokumen_level limit 6",$con);
while($n=mysql_fetch_array($t)){
if($dok_lvl==$n['nama_dok_level']){$selected='selected';}else{$selected='';}
$list_dok_level.='<option value="'.$n['nama_dok_level'].'" '.$selected.'>'.$n['nama_dok_level'].'</option>';
}
echo $list_dok_level;
?>
</select>
<input type="text" name="no_document" id="no_document" size="30" disabled="disabled" />
<script>
$("select").change(function () {
var str =$("#combo_issuer").val();
var doc =$("#combo_doc").val();
if(str!="" && doc!=""){
$.get("get_name.php", {issuer: str, doc_lvl: doc}, function(data){
//get the value from the get_name.php file and asign to display_name text filed
$("#no_document").val(data.split("-")[0]);
});
}
})
.change();
</script>
file2.php
$ID = $_GET['issuer'];
$doc_lvl = $_GET['doc_lvl'];
$sql1= mysql_query("SELECT MAX(id_dokumen) AS maxid from dokumen_internal WHERE issuer='".$ID."'");
$m=mysql_fetch_array($sql1);
$id_dok_max=$m['maxid'];
$sql3 = mysql_query("SELECT substring(no_dokumen, 11, 3) AS nomor FROM dokumen_internal WHERE id_dokumen='$id_dok_max' ") or die(mysql_error());
$n=mysql_fetch_array($sql3);
$nomor_max=$n['nomor'];
$no=$nomor_max++;
$no_inc=sprintf("%03s",$nomor_max);
$sql= mysql_query("SELECT * FROM departemen WHERE id_departemen = '".$ID."'");
$row = mysql_fetch_array($sql);
$display="SS/".$doc_lvl."/".$row['id_departemen'].$no_inc;
echo "SS/".$doc_lvl."/".$row['id_departemen'].$no_inc;
This code was succesfully display what i want.. but i can't get text from that field from no_document
<input type="text" name="no_document" id="no_document" size="30" disabled="disabled" />
i want get that value for insert .. May you know where is the bug ? .. Thank you so much ..
Upvotes: 0
Views: 39
Reputation: 410
You must set the field with readonly properties, if you set disabled properties on input tag then it will not be posted. ex:
<input type="text" name="no_document" id="no_document" size="30" readonly="readonly" />
Upvotes: 1