Foros del Web » Programando para Internet » PHP »

Como puedo pasar la variable en esta situacion?

Estas en el tema de Como puedo pasar la variable en esta situacion? en el foro de PHP en Foros del Web. En este php lo que hago es mostrar la informacion de una tabla, a un lado hay 2 botones, uno para eliminar el registro de ...
  #1 (permalink)  
Antiguo 19/04/2011, 11:36
Avatar de omar_gutierrez  
Fecha de Ingreso: febrero-2011
Mensajes: 144
Antigüedad: 13 años, 1 mes
Puntos: 2
Pregunta Como puedo pasar la variable en esta situacion?

En este php lo que hago es mostrar la informacion de una tabla, a un lado hay 2 botones, uno para eliminar el registro de la tabla, y el otro para editar el registro.

Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>E/M TASAS NIVEL PEDIMENTO</title>
<script type="text/javascript">
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
</script>
</head>
<style type="text/css">
a:link { color: #f00; } <--- color del enlace normal
a:visited { color: #0f0; } <--- color del enlace ya visitado
a:hover { color: #00f; } <--- color cuando se le pasa el puntero por encima
a:active { color: #ff0; } <--- color cuando se le hace clic.
</style>
<style type="text/css">

.relleno {
    font-family: Arial Narrow; font-size:16px
}
.titulo_tabla {
    font-family: Arial Narrow; font-size:16
}
</style>

<?php 
//conectar a mysql (ver archivo conexion.php)
include ("conexion.php");

if(@
$_REQUEST['action']=="del")
    {
mysql_query("DELETE
        FROM tasas_nivel_pedimento
        WHERE NUM ="
.round($_REQUEST['NUM']));
    }

?>
<body bgcolor="#CCCCCC">
<div align="center">
  <table class="titulo_tabla" width="533" border="1" cellspacing="0" cellpadding="0"> 
    <tr>
      <th colspan="8">TASAS NIVEL PEDIMENTO</th>
    </tr>
    <tr>
    <td width="175"><div align="center">NUM PEDIMENTO</div></td>
    <td width="86"><div align="center">CONTRIB</div></td>
    <td width="136"><div align="center">CVE T TASA</div></td>
    <td width="72"><div align="center">TASA</div></td>
    <td width="52" colspan="2"><div align="center"></div></td>
    </tr>

    <?php
        $qqq
;
$lista mysql_query("SELECT * FROM tasas_nivel_pedimento ORDER BY NUM DESC");
while(
$rs=mysql_fetch_array($lista)){
    
    echo 
"<tr height=\"30\">".
            
"<td align=\"center\" class=\"titulo_tabla\" >".$rs['NUM_PEDIMENTO']."</td>".
            
"<td align=\"center\" class=\"titulo_tabla\" >".$rs['CONTRIB']."</td>".
            
"<td align=\"center\" class=\"titulo_tabla\" >".$rs['CVE_T_TASA']."</td>".
            
"<td align=\"center\" class=\"titulo_tabla\" >".$rs['TASA']."</td>".
            
"<td align=\"center\" class=\"titulo_tabla\" width=\"30\"><a href=tasas_n_pedimento.php?action=del&NUM=".$rs['NUM']."><img src=\"http://127.0.0.1/testing/IMAGENES/b_drop.png\" alt=\"ELIMINAR\" title=\"Eliminar\"/></a></td>".
            
"<td align=\"center\" class=\"titulo_tabla\" width=\"30\"><a href=\"#\"><img src=\"http://127.0.0.1/testing/IMAGENES/b_edit.png\" alt=\"Eliminar\" title=\"Editar\" onclick=\"MM_openBrWindow('tasas_n_pedimento_edit.php','TASAS','width=570,height=170')\" /></a></td>".
            
"</tr>";
            }
 
?>

    

</table>
  <p>&nbsp;</p>
</div>
</body>
</html>
Para eliminar el registro ya esta listo. Lo que quiero es que cuando le de clic a editar se abra un popup con la informacion del registro seleccionado, poder editarlo, guardar y cerrar. el problema es que no se como hacer esto. Lo del popup ya quedo, puedo abrir la ventana, pero no se como pasar la una variable del renglon seleccionado, (el campo NUM es la llave unica, ese valor no lo muestro en la tabla que visualiza el usuario). He visto que tengo que usar href, pero este ya lo estoy usando para abrir la ventana emergente, que tengo que hacer para que funcione de la manera que pido?

Gracias de antemano.
  #2 (permalink)  
Antiguo 19/04/2011, 11:46
 
Fecha de Ingreso: enero-2008
Mensajes: 201
Antigüedad: 16 años, 3 meses
Puntos: 39
Respuesta: Como puedo pasar la variable en esta situacion?

Al hacer la llamada a la función que abre la ventana:

MM_openBrWindow('tasas_n_pedimento_edit.php','TASA S','width=570,height=170')


Pasale en la url el identificador del registro que quieres modificar:

tasas_n_pedimento_edit.php?NUM=".$rs['NUM']."
  #3 (permalink)  
Antiguo 19/04/2011, 12:17
Avatar de omar_gutierrez  
Fecha de Ingreso: febrero-2011
Mensajes: 144
Antigüedad: 13 años, 1 mes
Puntos: 2
Respuesta: Como puedo pasar la variable en esta situacion?

Cita:
Iniciado por _Ruben_ Ver Mensaje
Al hacer la llamada a la función que abre la ventana:

MM_openBrWindow('tasas_n_pedimento_edit.php','TASA S','width=570,height=170')


Pasale en la url el identificador del registro que quieres modificar:

tasas_n_pedimento_edit.php?NUM=".$rs['NUM']."
Muchas gracias por tu ayuda, despues de todo me di cuenta que no era dificil.
  #4 (permalink)  
Antiguo 14/12/2011, 11:02
 
Fecha de Ingreso: diciembre-2011
Mensajes: 13
Antigüedad: 12 años, 4 meses
Puntos: 0
Respuesta: Como puedo pasar la variable en esta situacion?

yO TENGO LA SIGUIENTE SITUACION TENGO EN EL FORM
<form action="<?php echo $editFormAction; ?>" method="POST" name="enviarregistro" class="enviar-form" id="enviarregistro" onsubmit="return validate_form1 ( ); cambiar();" >
YA QUE EN ESTE FORMULARIO O PAGINA ME MUESTRAS CIERTOS VALORES ESTA DEPENDE DE LA CONDICION QUE LE PUSE Y NECESITO QUE ME ENVIE UNA VARIABLE PARA EN QUE EN LA SIGUIENTE PAGINA ME CARGUE LOS VALORES INSERTADOS EN ESTE FORMULARIO PERO CON ESE ACTION NO ME DEJA CARGAR LA VARIABLE YA QUE EN LA OTRA PAGINA ME SALE NULL COMO SI NO EXISTIESE ALGUIEN SABE LA SOLUCION?

Etiquetas: links, pasar, variables
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta

SíEste tema le ha gustado a 1 personas




La zona horaria es GMT -6. Ahora son las 20:25.