Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/08/2011, 08:45
ChristianAlan
 
Fecha de Ingreso: agosto-2011
Ubicación: Guadalajara
Mensajes: 1
Antigüedad: 12 años, 9 meses
Puntos: 0
Pregunta borrar registros con ciclo while

Hola amigos, apenas estoy iniciando con php y me surgio un problema que no puedo solucionar. Les explico : Primero tengo una base de datos con registros ya guardados, lo que deseo hacer es borrar un registro de los que me aparece mediante una busqueda a la base de datos...
Código HTML:
<tr>
														<td  style="width:400px; height:32px"><label>FOLIO:</label><input name="folio" type="text" value="" onChange="nombre.disabled=true;folio.disabled=false"></td>
													  </tr>
                                                      <tr>
														<td  style="width:400px; height:32px"><label>NOMBRE:</label><input name="nombre" type="text" value="" onChange="folio.disabled=true;nombre.disabled=false"></td>
													  </tr>
<img src="images/spacer.gif" alt="" width="70" height="1"><strong><a href="javascript:limpiarform()">reset</a></strong>
<script type="text/javascript">
function limpiarform()
{
  document.tstest.reset();
}
</script>
<img src="images/spacer.gif" alt="" width="15" height="1">
<strong><a href="javascript:enviarformulario()"><img src="images/link2.gif" alt="" width="17" height="18" border="0"></a></strong>
<script type="text/javascript">
function enviarformulario()
{
  document.tstest.submit();
}
</script> 
Código PHP:
<?
                        
                    
//CONEXION
                    
require_once ('conexion.php');
                    
//TOMA EL FOLIO
                    
if (!isset($_POST['folio']))
                    {
                     
$folio 0;
                     } else
                     {
                        
$folio $_POST['folio'];
                     }
                     
//TOMA EL Nombre
                    
if (!isset($_POST['nombre']))
                    {
                     
$nombre 0;
                     } else
                     {
                        
$nombre $_POST['nombre'];
                     }
                    if(!empty(
$_POST['folio']) || (!empty($_POST['nombre'])))
                    {
                    
$result mysql_query("SELECT nombre,folio
                    FROM datosdesolicitud
                    WHERE nombre LIKE '%$nombre%' 
                    OR folio = '$folio' "
,$conexion);
                    if(!
$result)
                    {
                        die(
'Error en la Lectura: ' .mysql_error());
                    }
                    else{
                        while(
$row mysql_fetch_array($result))
                        {
                            echo
"<script language='javascript' type='text/javascript'>
<!--
function mayus(form){
    form.nombre.value = form.nombre.value.toUpperCase();
    form.direccion.value = form.direccion.value.toUpperCase();
    form.localidad.value = form.localidad.value.toUpperCase();
    form.solicitud.value = form.solicitud.value.toUpperCase();
    form.residente.value = form.residente.value.toUpperCase();
    form.observaciones.value = form.observaciones.value.toUpperCase();
    
}
//-->
</script>"
;
echo
"<table>";
echo
"<tr>";
echo
"<form name='formul' action='index-baja-elem.php' method='post' enctype='multipart/form-data' id='form'>";
echo
"</tr>";
echo
"<tr>";
echo
"<td  style='width:400px; height:32px'><label>NOMBRE:</label><input name='nombre' type='text' id='nombre' value='".$row["nombre"]."' onKeyUp='mayus(this.form)' maxlength='80' size='60' readonly></td>";
echo
"</tr>";
echo
"<tr>";
echo
"<td  style='width:400px; height:32px'><label>FOLIO:</label><input name='folio' type='text' id='folio' value='".$row["folio"]."' readonly size='60'></td>";
echo
"<td><input type='checkbox' name = 'cheka' onclick = 'enviarlo()'/> </td>";
echo
"</tr>";
echo
"<tr>";
echo
"<td  style='width:202px; height:60px'>";
echo
"<img src='images/title1_2.gif' alt='' width='205' height='51' style='margin-left:27px'>";
echo
"<br style='line-height:1px'>";
echo
"<img src='images/spacer.gif' alt='' width='140' height='1'>";
echo
"<img src='images/spacer.gif' alt='' width='70' height='1'>";
echo
"<img src='images/spacer.gif' alt='' width='15' height='1'>";
echo
"<script type='text/javascript'>
function enviarlo()
{
  document.formul.submit();
}
</script>"
;
echo
"<strong>dar de baja</strong>";
echo
"</td>";
echo
"</tr>";
echo
"</form>";
echo
"</table>";
                    }
                    }
                     }
                    
                    
?>
aqui me aparecen los registros que en el campo de busqueda ingreses, pero a la hora de dar click en el registro que deseo eliminar no hace nada, siempre y cuando encuentre mas de un registro. Si solo hay un registro este si se puede borrar.......
Me he matado mucho tiempo y no encontrado solucion,
Les agradeseria su ayuda..