Estoy intentando actualizar varias imagenes subidas de un producto, con lo siguiente,pero no aparece señal ninguna de los datos que estoy pasando....
Código PHP:
Ver original<?php
if(isset($_POST['el__id'])){
$sql = mysql_query("UPDATE productos SET nombreProd='$nombre__prod',precio='$precio__prod',detalles='$detalles__prod',id_ct='$id__cat',subcategoria ='$id__subcat' WHERE id= '$id' ");
$img =$_FILES["archivos"];
$img_editar =$_POST["editar"];
$tot = count($_FILES["archivos"]["name"]); for ($i = 0; $i < $tot; $i++){
$name = $_FILES["archivos"]["name"][$i];
$sql_f = mysql_query( "UPDATE fotoxproducto SET ruta_foto='$name' where idf='" .$img_editar. "'
}
}
header("location:inventorio_edit.php?pid=$id");
}
Y este es el form del producto en modo editar.:
Código HTML:
Ver original<form action="inventorio_edit.php" name="miform" id="miform" method="post"> <table cellspacing="0" cellpadding="0" style="height: 343px; width:84%;">
<?php
$sql1 = mysql_query("SELECT * FROM fotoxproducto where idproducto='$elid' ");
$numrows = mysql_num_rows($sql1);
while($row_foto = mysql_fetch_array($sql1)){
$idfoto = $row_foto["idf"];
$namefoto = $row_foto["ruta_foto"];
?>
<td style="width: 117px; height: 116px"> <img src="http://www.forosdelweb.com/f18/img_/<?php echo $namefoto; ?>" width="40" heigth="52" border="1" id="img" />
<a href="inventorio_edit.php?idfoto=<?php echo $idfoto ?>&rutafoto=<?php echo $namefoto; ?>
&pid=<?php echo $elid; ?>">Eliminar
</a>
<input name="editar" type="hidden" id="editar" value="<?php echo $idfoto; ?>"/>
<p>Editar
<?php echo $idfoto; ?></p> <input type="file" name="archivos[]" />
<?php } ?>
<td style="height: 25px; width: 325px;"><label for="textfield"></label> <input name="N__prod" type="text" id="N__prod" size="50" value="<?php echo $N__prod;?>" style="width: 180px" />
</td> <td style="height: 43px; width: 325px;"><label for="textfield2"></label> <input name="P__prod" type="text" id="P__prod" size="20" value="<?php echo $P__prod;?>" style="width: 180px" />
</td>
<?php
function generaSelect()
{
global $idcategoria;
include 'conexion.php';
//include '../includes/sesionID.php';
conectar();
$consulta=mysql_query("SELECT id_categoria, nombre_ct FROM categorias where id_subcategoria = 0 ");
desconectar();
echo "<select name='select1' id='select1' onChange='cargaContenido(this.id)' style='width:180px;' >";
while($registro=mysql_fetch_row($consulta))
{?>
<option value="<?php echo $registro[0]; ?>"
<?php if ($idcategoria == $registro[0]){ ?> selected = "selected"
<?php } ?> >
<?php echo $registro[1]; ?></option> <?php } ?>
<?php
echo "</select>";} ?>
<td style="width: 325px"> <div id="demo" style="width:174px;"> <div id="demoIzq" disabled="disabled" style="width: 180px"><?php generaSelect(); ?> <select name="select2" id="select2" style="width: 180px">
<?php
conectar();
$consulta2=mysql_query("SELECT * FROM categorias where id_subcategoria = '" . $idcategoria . "' ");
desconectar();
while($registro2=mysql_fetch_row($consulta2)){
?>
<option value="<?php echo $registro2[0]; ?>"
<?php if ($idsubcategoria == $registro2[0]){ ?> selected = "selected"
<?php } ?> >
<?php echo $registro2[1];?></option>
<?php } ?>
<td style="width: 325px"></td></tr>
<td style="width: 117px"> </td> <td style="width: 325px"> </td>
<textarea name="D__prod" id="D__prod" rows="5" style="width: 256px" ><?php echo $D__prod;?></textarea></td> <td style="width: 117px"> </td> <td style="width: 325px"> <input type="hidden" name="el__id" value="<?php echo $elid; ?>" />
<input type="submit" name="button" id="button" value="Modificar" onclick="//javascript:return validarMyForm();" /></td>