Ver Mensaje Individual
  #10 (permalink)  
Antiguo 13/06/2016, 14:24
fab2160225
 
Fecha de Ingreso: abril-2016
Mensajes: 90
Antigüedad: 8 años
Puntos: 1
Respuesta: Atascado para envio a base de datos varias lineas

Buenas, tienes que perdonar, pero esto se me está atragantando, suelo leer bastante antes de preguntar y generalmente con eso me basta, pero con esto no lo acabo de ver:
el mensaje de ajax no recibe la variable del select, las otras si, lo tengo de esta manera:
Cita:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script>
function envia(X){

var fecha = $("input[name=fecha][id="+X+"]").val();
var articulos = $("input[name=articulos][id="+X+"]").val();
var selected = $("select[name=selected][id="+X+"]").val();
$.ajax({
url: 'actualizar_pedido.php',
type: 'post',
data: { 'fecha': fecha, 'articulos': articulos, 'selected': selected},
success: function(data){
alert(fecha + " " + articulos + " " + selected);
/*AQUI LO QUIE QUIERES QUE HAGA LA RESPUESTA POR EJEMPLO UN ALERT*/
alert("Registro de "+articulos+" actualizado");
}
})

}
</script>
la parte de ajax no le veo problemas

Cita:
<article class="fondoArticulo">
<h2>Aquí podrás ver tus pedidos, y el Estado de los mismos</h2>
<br><br>
<table border="10" align="center" cellspacing="2" cellpadding="2" style="">
<tr>
<th style="border-color:#4E6FFF; border-width:3px; ">Fecha</th>
<th style="border-color:#4E6FFF; border-width:3px; ">Nombre</th>
<th style="border-color:#4E6FFF; border-width:3px; ">Pedido por</th>
<th style="border-color:#4E6FFF; border-width:3px; ">Dirección</th>
<th style="border-color:#4E6FFF; border-width:3px; ">Teléfono</th>
<th style="border-color:#4E6FFF; border-width:3px; ">Transporte</th>
<th style="border-color:#4E6FFF; border-width:3px; ">Articulo PVP Cantidad</th>
<th style="border-color:#4E6FFF; border-width:3px; ">Numero Pedido</th>
<th style="border-color:#4E6FFF; border-width:3px; ">Status</th>
</tr>
<?php
$fecha = $_POST['fecha'];
$nombre = $_POST['nombre'];
$nombreR = $_POST['nombreR'];
$direccion = $_POST['direccion'];
$telefono = $_POST['telefono'];
$metodoenvio = $_POST['metodoenvio'];
$npedido = $_POST['npedido'];


echo $fecha;
echo $nombre;
echo $nombreR;
echo $direccion;
echo $npedido;

?>
<?php


$sql = "SELECT * FROM pedidos where fecha='$fecha'";

$result = mysql_query($sql,Conectar::Conexion());
$rs = mysql_query($sql,Conectar::Conexion());
$num_rows = mysql_num_rows($result);

if($num_rows!=0){
while ($rol = mysql_fetch_array($result)){
?>
<?php
$status=$rol[14];
echo $rol[14];
?>
<tr>
<td align="middle" style="border-color:#D0142D; border-width:2px;">
<form action="actualizar_pedido.php" method="post" enctype="multipart/form-data">
<tr>

<td><input type="text" name="fecha" id="<?php echo $rol['id']; ?>" value="<?php echo $fecha; ?>" /></td>
<td><input type="text" name="nombre" id="<?php echo $rol['id']; ?>" value="<?php echo $nombre; ?>" /></td>
<td><input type="text" name="nombreR" id="<?php echo $rol['id']; ?>" value="<?php echo $nombreR; ?>" /></td>
<td><input type="text" name="direccion" id="<?php echo $rol['id']; ?>" value="<?php echo $direccion; ?>" /></td>
<td><input type="text" name="telefono" id="<?php echo $rol['id']; ?>" value="<?php echo $telefono; ?>" /></td>
<td><input type="text" name="metodoenvio" id="<?php echo $rol['id']; ?>" value="<?php echo $metodoenvio; ?>" /></td>
<td><input type="text" name="articulos" id="<?php echo $rol['id']; ?>" value="<?php echo $rol[11]; ?>" /></td>
<td><input type="text" name="npedido" id="<?php echo $rol['id']; ?>" value="<?php echo $npedido; ?>" /></td>
<td>
<select name="status[]">
<?php
$i=0;

$sql = "SELECT * FROM status";
$re = mysql_query($sql, Conectar::Conexion());
while($col = mysql_fetch_array($re)){
?>
<option value="<?php echo $col[1]; ?>" <?php if ($status== $col[1]) {?> selected="selected" <?php }?>> <?php echo $col[1]; ?></option>

<?php
}
?>
<?php
$i=0;
while($i<1){
$rol[11];
$i++;}
?>
</select></td>
<td><input type="text" name="selected" id="<?php echo $rol['id']; ?>" value="<?php echo $col[$i][1]; ?>"/><td>
<td><input type="button" id="<?php echo $rol['id']; ?>" onClick="envia(this.id)" </td>
agradezco tu paciencia