Se los dejo y si quieren modificar el código para agregarle cositas como eliminación de filas o sobre todo para simplificar y mejorar lo pueden hacer con toda libertad (es mas estaría muy agradecido).
Muchas gracias a todos por la ayuda y espero podamos hacer muchas cosas juntos. Abrazo.
venta.php
Código PHP:
<div id="venta">
<div id="ventas-up">
</div>
<div id="dawn">
<div id="ventas-left">
<form id="form1" name="form1" method="post" action="">
<br>
<p style="font-size:33px">INGRESO:<br><br>
ARTICULO:<input type="text" name="id" id="id"/><br>
</p><br><br><br>
<?if (!empty($_POST["id"])){
$id= $_POST["id"];
$query="SELECT * FROM stock WHERE id_stock='".$id."'";
$rst= mysqli_query($patricio,$query);
while ($f1=mysqli_fetch_array($rst))
{
$r_id_stock=$f1["id_stock"];
$r_articulo=$f1["articulo"];
$r_marca=$f1["marca"];
$r_modelo=$f1["modelo"];
$r_color=$f1["color"];
$r_talle=$f1["talle"];
$r_numero=$f1["numero"];
$r_valor=$f1["valor"];
?>
<?echo 'ARTICULO: '.$r_articulo.'<br>MARCA: '.$r_marca.'<br>MODELO: '.$r_modelo.'<br>COLOR: '.$r_color.'<br>TALLE: '.$r_talle.'<br>NUMERO: '.$r_numero.'<br><br>'?>
</div>
<div align="center" id="ventas-right">
<div style="width:500px" id="ventas-right-up">
<table align="center" cellpadding="0" cellspacing="0" border="2" width="100%" style="text-align: center; border-color: #E5E5E5; ">
<tr style= "background: #DDFFCA;">
<td class='td'>ARTICULO</td>
<td class='td'>VALOR</td>
<td class='td'>CANTIDAD</td>
<td class='td'>SUBTOTAL</td>
<td class='td'></td>
</tr>
<?
//---------------------------------------------------------------------------------------------------------------------------
$max_ven="select max(id) from venta_real";
$max_vent=mysqli_query($patricio,$max_ven);
$max_venta= mysqli_fetch_array($max_vent);
$max_venta_real=$max_venta[0];
//---------------------------------------------------------------------------------------------------------------------------
$insert_cuenta="insert into ventas (max_venta_real,id_stock,articulo,valor)values('".$max_venta_real."','".$r_id_stock."','".$r_articulo."','".$r_valor."')";
$res_insert=mysqli_query($patricio,$insert_cuenta);
$max_venta= mysqli_insert_id($patricio);
//---------------------------------------------------------------------------------------------------------------------------
$query="select * from ventas where max_venta_real='".$max_venta_real."'";
//---------------------------------------------------------------------------------------------------------------------------
if ($result1 = mysqli_query($patricio, $query)) {
mysqli_data_seek($result1, 0);
$row1 = mysqli_fetch_row($result1);
mysqli_free_result($result1);
}
//---------------------------------------------------------------------------------------------------------------------------
if ($result2 = mysqli_query($patricio, $query)) {
mysqli_data_seek($result2, 1);
$row2 = mysqli_fetch_row($result2);
mysqli_free_result($result2);
}
//---------------------------------------------------------------------------------------------------------------------------
if ($result3 = mysqli_query($patricio, $query)) {
mysqli_data_seek($result3, 2);
$row3 = mysqli_fetch_row($result3);
mysqli_free_result($result3);
}
//---------------------------------------------------------------------------------------------------------------------------
if ($result4 = mysqli_query($patricio, $query)) {
mysqli_data_seek($result4, 3);
$row4 = mysqli_fetch_row($result4);
mysqli_free_result($result4);
}
//---------------------------------------------------------------------------------------------------------------------------
if ($result5 = mysqli_query($patricio, $query)) {
mysqli_data_seek($result5, 4);
$row5 = mysqli_fetch_row($result5);
mysqli_free_result($result5);
}
//---------------------------------------------------------------------------------------------------------------------------
if ($result6 = mysqli_query($patricio, $query)) {
mysqli_data_seek($result6, 5);
$row6 = mysqli_fetch_row($result6);
mysqli_free_result($result6);
}
//---------------------------------------------------------------------------------------------------------------------------
if ($result7 = mysqli_query($patricio, $query)) {
mysqli_data_seek($result7, 6);
$row7 = mysqli_fetch_row($result7);
mysqli_free_result($result7);
}
//---------------------------------------------------------------------------------------------------------------------------
if ($result8 = mysqli_query($patricio, $query)) {
mysqli_data_seek($result8, 7);
$row8 = mysqli_fetch_row($result8);
mysqli_free_result($result8);
}
//---------------------------------------------------------------------------------------------------------------------------
if ($result9 = mysqli_query($patricio, $query)) {
mysqli_data_seek($result9, 8);
$row9 = mysqli_fetch_row($result9);
mysqli_free_result($result9);
}
//---------------------------------------------------------------------------------------------------------------------------
if ($result10 = mysqli_query($patricio, $query)) {
mysqli_data_seek($result10, 9);
$row10 = mysqli_fetch_row($result10);
mysqli_free_result($result10);
}
//---------------------------------------------------------------------------------------------------------------------------
?>
</form>
<form action="guardar/venta.php" method="POST">
<input type="hidden" name="max_venta_real" value="<?echo $max_venta_real?>"/>
<tr>
<td><input type="text" name="articulo1" id="articulo1" value="<?echo $row1[3]?>" class="articulo1" style="border:none"/></td>
<td><input type="text" name="valor1" id="valor1" value="<?echo $row1[4]?>" class="valor1" style="width:40px;text-align:center;border:none"/></td>
<td><input type="text" name="cantidad1" id="cantidad1" value="<?if($row1[5]==0){$r=1;echo $r;}else{echo $row1[5];}?>" class="cantidad1" style="width:40px;text-align:center;border:none"/></td>
<td><input type="text" name="subtotal1" id="subtotal1" value="<?echo $row1[6]?>" class="subtotal" style="width:40px;text-align:center;border:none"/></td>
</tr>
<?if($row2[0]!=$row1[0]){
?>
<tr>
<td><input type="text" name="articulo2" id="articulo2" value="<?echo $row2[3]?>" class="articulo2" style="border:none"/></td>
<td><input type="text" name="valor2" id="valor2" value="<?echo $row2[4]?>" class="valor2" style="width:40px;text-align:center;border:none"/></td>
<td><input type="text" name="cantidad2" id="cantidad2" value="<?if($row2[5]==0){$r=1;echo $r;}else{echo $row2[5];}?>" class="cantidad2" style="width:40px;text-align:center;border:none"/></td>
<td><input type="text" name="subtotal2" id="subtotal2" value="<?echo $row2[6]?>" class="subtotal" style="width:40px;text-align:center;border:none"/></td>
</tr>
<?};
if($row3[0]!=$row2[0]and$row3[0]!=$row1[0]){
?>
<tr>
<td><input type="text" name="articulo3" id="articulo3" value="<?echo $row3[3]?>" class="articulo3" style="border:none"/></td>
<td><input type="text" name="valor3" id="valor3" value="<?echo $row3[4]?>" class="valor3" style="width:40px;text-align:center;border:none"/></td>
<td><input type="text" name="cantidad3" id="cantidad3" value="<?if($row3[5]==0){$r=1;echo $r;}else{echo $row3[5];}?>" class="cantidad3" style="width:40px;text-align:center;border:none"/></td>
<td><input type="text" name="subtotal3" id="subtotal3" value="<?echo $row3[6]?>" class="subtotal" style="width:40px;text-align:center;border:none"/></td>
</tr>
<?};
if($row4[0]!=$row3[0]and$row4[0]!=$row2[0]and$row4[0]!=$row1[0]){
?>
<tr>