PHP MySQL Auto-generated input value wont enter the PhpMyAdmin Database

PHP MySQL Auto-generated input value wont enter the PhpMyAdmin Database



So i'm making this text line to make a reference number, while choosing BPI in Request type, the code_cr will be manually selected (CR/PR/BR)in a combo-box, while choosing CR/PR/BR/T will auto-generate the respective CR/PR/BR/T in the autogen_number text field, the BPI works fine, and the input all enters the database (ex on selecting BPI : CR-001-08-18-PI1) but when selecting CR/PR/BR/T in the request type, yes it autogenerated, but the first text line wont be inputted into the database (ex on selecting CR/PR/BR/T: -001-08-18), the supposed CR/PR/BR/T on the front of -001-08-18 is missing in the database.




<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;
-->





you current code does not describe your problem fully but check your data base datatype for you specific column try changing it to varchar(255)
– Bobby Axe
Aug 30 at 2:40



datatype


varchar(255)






Required, but never shown



Required, but never shown






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Malaysia to Papua New Guinea by motorcycle?

List of Bhojpuri films

PHP code is not being executed, instead code shows on the page