                                                                                                                                                                                                                        
<html>
<head>
<link href="../estilos/estilos.css" type="text/css" rel="stylesheet">
</head>
<script language="javascript">

function pon_prefijo(cdgmod) {

	parent.document.form_lineas.dscmod.focus();
	parent.document.form_lineas.cdgmod.value=cdgmod;


}



</script>
<?php include ("../conexion.php"); ?>
<body>
<?php

	
	$cdgmar=$_GET["cdgmar"];
	


	$consulta = "SELECT MAX(cdgmod) AS cdgmod FROM modelos WHERE  cdgmar = $cdgmar";
	$resultado = $mysqli->query($consulta);
	$fila = $resultado->fetch_array();
						$cdgmod =  $fila["cdgmod"];
						$cdgmod = $cdgmod + 1 ;
						$cdgmod = sprintf("%03d",$cdgmod);
						

				?>
				<script>
				pon_prefijo("<?php echo $cdgmod ?>");	
				</script>
       			<?php 

?>
</div>
</body>
</html>
