el cual me abre un modal para editar una fila especifica con este codigo
Código PHP:
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Boleta de Retencion</title>
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Theme CSS -->
<link href="css/clean-blog.min.css" rel="stylesheet">
<link href="css/estilo.css" rel="stylesheet">
<!-- Custom Fonts -->
<link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href='https://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
<script src="js/jquery.js" type="text/javascript"></script>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
<script src="http://cdnjs.cloudflare.com/ajax/libs/jQuery-Validation-Engine/2.6.4/jquery.validationEngine.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script type="text/javascript">
var nav4 = window.Event ? true : false;
function acceptNum(evt){
var key = nav4 ? evt.which : evt.keyCode;
return (key <= 44 || (key >= 48 && key <= 57));
}
</script>
<script type="text/javascript">
$(document).ready(function (e){
$('#modal-container-2708').on('show.bs.modal',function(e){
var id = $(e.relatedTarget).data().id;
var result=$.ajax({
type:"POST",data:$("#modal-container-2708").serialize(),
url:'cursor.php',
data:'id='+id,
dataType:'text',
async:false
}).responseText;
document.getElementById("datacurso").innerHTML=result;
});
});
</script>
</head>
<body>
<?php
if (empty($_POST))
{ echo '
<div class="bg-danger text-center">
<p><span class="fa fa-times" aria-hidden="true"></span> No indicó que desea observar.</p>
</div>';
die();
}
include 'conexion_1.php'; # conexión base de datos
$id = $_POST["id"];
?>
<form name="vamos" method="GET" action="pico.php">
<div class="col-md-12 text-center">
<table id="tblprod" class="table table-hover table-bordered">
<thead>
<tr>
<th>Nombre Mercancia</th>
<th>Descripción Unidad</th>
<th>Total Unidades</th>
<th id="total">Peso</th>
<th id="total">N° Bulto</th>
<th>Descripción</th>
<th>Guardar</th>
</tr>
</thead>
<?php
$totalpeso="0";
$totalbulto="0";
$resultado1 = mysql_query("SELECT * FROM mercancia WHERE id = '$id'");
while ($row1 = mysql_fetch_array($resultado1)){
?>
<tbody>
<?php
echo "<tr>";
echo "<td>";
?>
<input class="form-control" type="text" name="cantidad1" id="cantidad1" value="<?php echo $row1["cantidad"]; ?>"
<?php
echo "</td>";
echo "<td>";
?>
<input class="form-control" type="text" name="tipo1" id="tipo1" value="<?php echo $row1["tipo"];?>"
<?php
echo "</td>";
echo "<td>";
?>
<input class="form-control" type="text" name="contenido1" id="contenido1" value="<?php echo $row1["contenido"];?>"
<?php
echo "</td>";
echo "<td id='total'´>";
?>
<input class="form-control" type="text" name="peso1" id="peso1" value="<?php echo $row1["peso"];?>"
<?php
echo "</td>";
echo "<td id='total'´>";
?>
<input class="form-control" type="text" name="bulto1" id="bulto1" value="<?php echo $row1["bulto"];?>"
<?php
echo "</td>";
echo "<td id='izq'>";
?>
<textarea class="form-control" name="descripcion" id="descripcion1"><?php echo $row1["descripcion"];?></textarea>
<?php
echo "</td>";
echo "<td>";
echo "<input type='submit' value='guardar'/>";
echo "<center><a href='#' onClick='url6()'><img width='20px' class='img-responsive' src='img/Save.png'/></a></center>";
echo "</td>";
$totalpeso=$row1["peso"]+$totalpeso;
$totalbulto=$row1["bulto"]+$totalbulto;
}
?>
</tbody>
</table>
</div>
</form>
</body>
<script>
function url6(){
var valor1 = $("#cantidad1").val();
var valor2 = $("#tipo1").val();
var valor3 = $("#contenido1").val();
var valor4 = $("#descripcion1").val();
var valor5 = $("#fecha").val();
var valor6 = $("#rut").val();
var valor7 = $("#peso1").val();
var valor9 = $("#bulto1").val();
var valores = '?';
if(valor1!='seleccione'){
valores += 'cantidad1='+valor1;
}
if(valor2!='seleccione'){
valores += '&tipo1='+valor2;
}
if(valor3!='seleccione'){
valores += '&contenido1='+valor3;
}
if(valor4!='!EMPTY'){
valores += '&prod1='+valor4;
}
if(valor5!='!EMPTY'){
valores += '&fecha1='+valor5;
}
if(valor6!='!EMPTY'){
valores += '&rut1='+valor6;
}
if(valor7!='!EMPTY'){
valores += '&peso1='+valor7;
}
if(valor9!='seleccione'){
valores += '&bulto1='+valor9;
}
var url = 'update3.php'+valores;
if(confirm("¿Desea Actualizar la Mercancia?"))
window.location.href=url;
else
window.back;
}
</script>
</html>
Quedo atento a sus comentarios amigos