Ver Mensaje Individual
  #3 (permalink)  
Antiguo 05/07/2009, 12:29
lauramiracle
 
Fecha de Ingreso: febrero-2009
Mensajes: 77
Antigüedad: 15 años, 3 meses
Puntos: 0
Respuesta: problema con array y chekbutton

Código PHP:
<div id="contenedor">
  <form name="frm" id="frm" action="elimnot2.php" method="post">
  <table width="603" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td colspan="2" class="noticias">NOTICIAS PCI </td>
    </tr>
    <?php
    $n
=0;
            while(
$n<$totaltitulos1)
            {
                if(
$titulo1[$n]!=NULL)
                {
                
?>    
    <tr>
      <td width="52"><input type="checkbox" name="borradopci[<?php echo $n ?>]" 
                                            value="<?php echo $titulo1[$n?>" ></td>
      <td width="551" class="titulo"><?php echo $titulo1[$n?></td>
    </tr>
   <?php
                
}
                    
$n++;
            }
     
?>

elimnot2.php


Código PHP:
$pci=$_POST['borradopci'];
    
//conexion    
    
$di="localhost";
    
$usuario="localhost";
    
$clave="localhost";
    
$conexion=mysql_connect($di,$usuario,$clave);
    if(
$conexion==NULL)
    {
        echo (
"Error");
    }
    
$db='deinsa';
    
mysql_select_db($db,$conexion);

$arraypci=count($pci);


$n=0;
while(
$n<$arraypci)
{
    
$borrar1="DELETE FROM noticias WHERE titulo='".$pci[$n]."'";
    
//echo $borrar1;
         
$consultamysql=mysql_query($borrar1,$conexion);
     
$n++;