PHP MySQL自动生成的输入值不会输入PhpMyAdmin数据库

时间:2018-08-30 02:26:37

标签: javascript php

因此,我正在使此文本行成为参考编号,同时在“请求类型”中选择BPI时,将在组合框中手动选择(CR / PR / BR)code_cr,同时选择CR / PR / BR / T将在autogen_number文本字段中自动生成相应的CR / PR / BR / T,BPI正常运行,并且所有输入均进入数据库(例如,选择BPI:CR-001-08-18-PI1),但是在请求类型中选择CR / PR / BR / T时,是的,它是自动生成的,但是不会将第一行文本输入到数据库中(例如,选择CR / PR / BR / T:-001-08-18),数据库中缺少-001-08-18前面的假定CR / PR / BR / T。

<script type="text/javascript">
	$(document).ready(function() {
		document.getElementById('non_bpi').style.display="none";
		document.getElementById('bpi').style.display="none";
	});
	function cekisi(){
		var e = document.getElementById("cr_jenis");
		var status = e.options[e.selectedIndex].value;
		if(status == 'BPI'){
			document.getElementById('non_bpi').style.display="none";
			document.getElementById('bpi').style.display="block";
		}else{
			document.getElementById('autoprefix').value = status;
			document.getElementById('non_bpi').style.display="block";
			document.getElementById('bpi').style.display="none";
		}
	}
</script>
<tr>
<td align='left'>Request Type </td>
<td align='left'>:
	<select name='cr_jenis' id='cr_jenis'  onchange="cekisi(),setitem(this.value);" value=' <?php echo $input[54]; ?>'>
    <option value=''>-Pilih-</option>
    <option value='CR'>CR</option>
    <option value='PR'>PR</option>
    <option value='BR'>BR</option>
    <option value='T'>T</option>
    <option value='BPI'>BPI</option>
  </select>
</td>

</tr>
	<tr>
	<td align='left'>Request Number</td>
	<td align='left'>: </td>
	<td>
		<div id="bpi">
			<select name="code_cr">
		    <option value='' disabled selected>-Pilih-</option>
		    <option value='CR'>CR</option>
		    <option value='PR'>PR</option>
		    <option value='BR'>BR</option>
		  </select>
			<input type="text" name="cr_num"  value="<?php echo $new_num; ?>" id="autoprefix2" size="4"> -
			<input type="text" name="cr_mon" value="<?php echo $bulan_sekarang; ?>" id="bulan" size="4"> -
			<input type="text" name="cr_year" value="<?php echo $tahun_sekarang; ?>" id="tahun" size="4"> -
			<input type="text" name="cr_pi_id" value="" id="pi" size="4">
		</div>
		<div id="non_bpi">
			<input type="text" name="autogen_number" id="autoprefix" size="4"> -
			<input type="text" name="cr_num" value="<?php echo $new_num; ?>" id="nomor" size="4"> -
			<input type="text" name="cr_mon" value="<?php echo $bulan_sekarang; ?>" id="bulan" size="4"> -
			<input type="text" name="cr_year" value="<?php echo $tahun_sekarang; ?>" id="tahun" size="4">
		</div>
	</td>
  
  
  
 <!-- THIS IS THE INPUT TO CONNECT cr_code, cr_num, cr_mon, cr_year, AND THE OPTIONAL cr_pi_id FOR BPI
 $values = "";
if($phase != '')
{
$values .= "-$phase";
}
if($modul != '')
{
$values .= "-$modul";
}
if($crpid != '')
{
$values .= "-$crpid";
}
    $content = $_POST['code_cr'] . "-" . $_POST['cr_num'] . "-" . $_POST['cr_mon'] . "-" . $_POST['cr_year'] . $values;
    -->

0 个答案:

没有答案