Pass select value obtained by js to a php variable in an invoice number

0

As I said above I have an invoice number which has to carry the code of the department and what I want is that depending on the department that you select the invoice number change that is if you select purchases the invoice number will be "COMN1"

I have the following code that gets the data for js however I do not know how to send that dynamic variable to my code to generate number

<script> $(function(){
$(document).on('change','#codd',function(){ //detectamos el evento change
  var value = $(this).val();//sacamos el valor del select
  $('#dep').val(value);//le agregamos el valor al input (notese que el input debe tener un ID para que le caiga el valor)
});
});

and my code to generate the order number in the variable code is where I want to save that data

<?php       /*Este codigo nos servira para generar un numero diferente para cada ticket*/
      $codigo = ""; 
      $con=mysql_connect('localhost', 'root', '' );
          mysql_select_db('sisteman');
      $num=mysql_query("SELECT * FROM ordenes") or die(mysql_error());
      $numero_filas = mysql_num_rows($num);

      $numero_filas_total=$numero_filas+1;
      $ido="ORD".$codigo."N".$numero_filas_total;

      /*Fin codigo numero de ticket*/?>
    
asked by Mar 17.07.2018 в 01:58
source

0 answers