Bir süre döngü Onay Kutusu

0 Cevap

Kullanıcıların silmek için bir mesajı kontrol edebilirsiniz işlevi oluşturmak için çalışıyorum. Birden fazla mesaj işaretli ise Açıkçası, hepsi silinecektir.

Ben aşağıdaki kodu var

<form action="process.php" method="post">
    <input type="hidden" name="deleteMessages" />
    <?php
    while($row=mysql_fetch_assoc($q))
    {
        if($row['to_viewed'] == 0)
        {
        ?>
        <tr>
            <td><input type="hidden" name="check_box_1" value="0" />
                <input type="checkbox" name="check_box_1" value="1" />
            </td>
            <td><b><a href='<?php echo $_SERVER['PHP_SELF']; ?>?p=view&mid=<?php echo $row['id']; ?>'><?php echo $row['title'] ?></a></b></td>
            <td><b><a href='<?php echo $_SERVER['PHP_SELF']; ?>?p=view&mid=<?php echo $row['id']; ?>'><?php echo $row['from']; ?></a></b></td>                
            <td><b><?php echo $row['created']; ?></b></td>
        </tr>
        <?php
        }
        else if($row['to_viewed'] == 1)
        {
        ?>
        <tr>
            <td><input type="hidden" name="check_box_1" value="0" />
                <input type="checkbox" name="check_box_1" value="1" />
            </td>
            <td><a href='<?php echo $_SERVER['PHP_SELF']; ?>?p=view&mid=<?php echo $row['id']; ?>'><?php echo $row['title'] ?></a></td>
            <td><a href='<?php echo $_SERVER['PHP_SELF']; ?>?p=view&mid=<?php echo $row['id']; ?>'><?php echo $row['from']; ?></a></td>                
            <td><?php echo $row['created']; ?></td>
        </tr>
        <?php
        }
    }
    ?>
    <input type="submit" value="Delete All" />
    </form>

I want to pass the checkbox through and if the value is 1, process it and delete it. But how would I achieve this with mulitple messages no matter if there is one message or ten? Thanks

0 Cevap