Ver Mensaje Individual
  #3 (permalink)  
Antiguo 25/03/2005, 07:16
Avatar de Seppo
Seppo
 
Fecha de Ingreso: marzo-2005
Ubicación: Buenos Aires, Argentina
Mensajes: 1.284
Antigüedad: 19 años, 1 mes
Puntos: 17
Se podría decir que estás con suerte... Hice el mismo código ayer, espero que te sirva

Código PHP:
<?php require_once("../conexion/conexion.php");?>
<?php 
require_once("validate.php");?>
<?php
if ($_POST['action'] == "modif") {
    for (
$a=0;$a<count($_POST['id']);$a++) {
        
$id  $_POST['id'][$a];
        if (
$_POST['siono'][$id] == "on") {
            
$si[] = $_POST['id'][$a];
        } else {
            
$no[] = $_POST['id'][$a];
        }
    }
    if (
count($si) > 0) { mysql_query("UPDATE user SET estatus='S' WHERE id_user IN (".implode(",",$si).")"); }
    if (
count($no) > 0) { mysql_query("UPDATE user SET estatus='N' WHERE id_user IN (".implode(",",$no).")"); }
    
header("location:usuarios.php);
    exit;
}
?>


    <table width="
800">
    <form method="
post" name="form" action="usuarios.php">
    <tr><td width="
34">&nbsp;</td> <td>Nombre</td><td>Telefono</td></tr>
    <?php
    $q_user = mysql_query("
SELECT id_userusernametelefonoestatus FROM user") or die(mysql_error());
    while ($user = mysql_fetch_assoc($q_user)) { ?>
        <tr>
        <td><input type="
checkbox" name="siono[<?php echo $art['id_user']; ?>]" <?php if ($art['estado'] == "S") { echo "checked"; }  ?>></td>
        <input type="hidden" name="id[]" value="<?php echo $art['id_user']; ?>">
        <td><?php echo $art['username']; ?></td>
        <td><?php echo $art['telefono']; ?></td>
        </tr>
    <?php ?>
    <tr><td colspan="3"><input type="submit" value="Actualizar"></td></tr>
    <input type="hidden" name="action" value="modif">
    </form>
    </table>