Re: Chekbox delete option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



USE THIS MAY HELP YOU
<td><input name="delete_id[]" type="checkbox" value="<?=$row[ "id"]?>"> </td>



--- In php-objects@xxxxxxxxxxxxxxx, kashi kashan <ksncool@...> wrote:
>
> 
> 
> 
> 
> 
> If u r beginner in php thn use following code(may b it is
> help full )
> 
> Else show ur code
> 
> 
> 
> <form action="delete.php" method = "POST">
> </table>
> <?php
> $con = mysql_connect("localhost","mysql_user","mysql_pwd");
> if (!$con)
>   {
>   die('Could not connect: ' . mysql_error());
>   }
> mysql_select_db("my_db", $con);
> 
> $sql = "SELECT * FROM Person";
> $rs = mysql_query($sql,$con);
> while($row=mysql_fetch_array($rs)){        
> ?>
> 
> <tr>
> <td><input name="delete_id" type="checkbox" value="<?=$row["id"]?>"></td>
>   <td><?=$row[colom_name_1]?></td>
>   <td><?=$row[colom_name_2]?></td>
>   <td><?=$row[colom_name_3]?></td>
> </tr>
> <? } ?>
> <tr>
> <td><input name="Delete" type="submit"></td>
> </tr>
> </table>
> </form>
> 
> -----------------------------------------
> 
> delete.php:
> 
> <?php
> $con = mysql_connect("localhost","mysql_user","mysql_pwd");
> if (!$con)
>   {
>   die('Could not connect: ' . mysql_error());
>   }
> 
> mysql_select_db("my_db", $con);
> 
> mysql_query("DELETE FROM table_name WHERE colom_name=".$_POST['delete_id'].");
> 
> mysql_close($con);
> ?> 
> 
> 
> 
>       
> 
> [Non-text portions of this message have been removed]
>



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux