Foros del Web » Programando para Internet » PHP »

Manejo De Arrays De Cajas De Texto Con Hiperenlaces

Estas en el tema de Manejo De Arrays De Cajas De Texto Con Hiperenlaces en el foro de PHP en Foros del Web. Manejo De Arrays De Cajas De Texto Con Hiperenlaces -------------------------------------------------------------------------------- Hola a todos,espero su ayuda que ya stoy desde hace rato con este problema. Lo ...
  #1 (permalink)  
Antiguo 13/04/2007, 07:41
 
Fecha de Ingreso: octubre-2006
Mensajes: 79
Antigüedad: 17 años, 6 meses
Puntos: 0
Manejo De Arrays De Cajas De Texto Con Hiperenlaces

Manejo De Arrays De Cajas De Texto Con Hiperenlaces

--------------------------------------------------------------------------------

Hola a todos,espero su ayuda que ya stoy desde hace rato con este problema.
Lo que pasa que tengo un formulario con varios arrays de cajas de texto.Inmersos alli hieperlances .deseo recoger los valores de las variables correctas en otra pagina del registro chickeado(en el hiperenlace) pero la pagina destino no los captura,el codigo en el q parece q radica el error es el que esta en negrita.


Parte de Mi codigo es mas o menos asi:

<table border="2" align="center" bordercolor="#ECE9D8">
<tr>
<th>Artículo</th>
<th>Descripción</th>
<th>Centro de Costos</th>
<th>Cantidad</th>
<th>Precio</th>
<th>Impuesto</th>
<th>Importe</th>
<th>Total</th>
</tr>
<?
for ($i=1;$i<=$txtNroProductos;$i++)
{?>
<tr>
<td height="22" width="20" bordercolordark="#454560"><input type="text" size="10" name="txtidArticulo[]">
</td>
<td height="22"><input type="text" name="txtdescArticulo[]">
<? // <input type="submit" name="btnAyuda" value=" " onClick="<? $NUMERO=$txtdescArticulo[$i];?>

<? echo "<td><a href=\"ayudaDescripCP.php ?numero=".$txtdescArticulo[$i]."\">Ayuda</a></td>";
?></td>

<td height="22" width="20"><input type="text" size="10" name="txtvccArticulo[]"></td>
<td height="22" width="20"><input type="text" size="10" name="txtcantArticulo[]"></td>
<td height="22" width="20"><input type="text" size="10" name="txtprecioArticulo[]"></td>
<td height="22" width="20"><input type="text" size="10" name="txtimpuestoArticulo[]"></td>
<td height="22" width="20"><input type="text" size="10" name="txtimporteArticulo[]"></td>
<td height="22" width="20"><input type="text" size="10" name="txttotalArticulo[]"></td>
</tr>
<?
}
?>
</table >
  #2 (permalink)  
Antiguo 13/04/2007, 10:26
Avatar de claudiovega  
Fecha de Ingreso: octubre-2003
Ubicación: Puerto Montt
Mensajes: 3.667
Antigüedad: 20 años, 5 meses
Puntos: 11
Re: Manejo De Arrays De Cajas De Texto Con Hiperenlaces

Dado el hiperenlace, la única variable que se puede capturar es la variable numero. Como no hay submit al hacer click en el hiperenlace, no puedes acceder a los valores de las cajas de texto.
  #3 (permalink)  
Antiguo 13/04/2007, 10:55
 
Fecha de Ingreso: octubre-2006
Mensajes: 79
Antigüedad: 17 años, 6 meses
Puntos: 0
Re: Manejo De Arrays De Cajas De Texto Con Hiperenlaces

Si ps eso pienso,pero La variable $numero no lo puedo capturar,me sale nulo...
  #4 (permalink)  
Antiguo 13/04/2007, 12:00
Avatar de claudiovega  
Fecha de Ingreso: octubre-2003
Ubicación: Puerto Montt
Mensajes: 3.667
Antigüedad: 20 años, 5 meses
Puntos: 11
Re: Manejo De Arrays De Cajas De Texto Con Hiperenlaces

Al menos en el código que muestras no estás asignándole valor a la variable $txtdescArticulo[$i] en ninguna parte. Luego estás pasando el valor de esa variable a numero, pero si no tiene valor.
  #5 (permalink)  
Antiguo 13/04/2007, 13:34
 
Fecha de Ingreso: octubre-2006
Mensajes: 79
Antigüedad: 17 años, 6 meses
Puntos: 0
Re: Manejo De Arrays De Cajas De Texto Con Hiperenlaces

$txtdescArticulo[$i] es una caja de texto .Y mi idea es pasara el valor de esa caja de texto....
  #6 (permalink)  
Antiguo 13/04/2007, 15:13
Avatar de claudiovega  
Fecha de Ingreso: octubre-2003
Ubicación: Puerto Montt
Mensajes: 3.667
Antigüedad: 20 años, 5 meses
Puntos: 11
Re: Manejo De Arrays De Cajas De Texto Con Hiperenlaces

no puedes hacerlo con un link, debes usar un botón submit o escribir código javascript para hacerlo mediante el link.
Ahora, por que quieres hacerlo de esa forma?
  #7 (permalink)  
Antiguo 13/04/2007, 15:58
 
Fecha de Ingreso: octubre-2006
Mensajes: 79
Antigüedad: 17 años, 6 meses
Puntos: 0
Re: Manejo De Arrays De Cajas De Texto Con Hiperenlaces

He Probado Con Submit Y Con Java Script Pero No Logro Obtener Los Resultados Requeridos.no Puedo Obtener Los Valores De Esa Cajas De Texto
  #8 (permalink)  
Antiguo 13/04/2007, 16:14
Avatar de claudiovega  
Fecha de Ingreso: octubre-2003
Ubicación: Puerto Montt
Mensajes: 3.667
Antigüedad: 20 años, 5 meses
Puntos: 11
Re: Manejo De Arrays De Cajas De Texto Con Hiperenlaces

Que quieres hacer? Que el usuario escriba algo y que según lo que escriba en la caja de texto se le de una ayuda? O la ayuda esta referida al campo que tiene que llenar?
  #9 (permalink)  
Antiguo 13/04/2007, 16:31
Avatar de gerson  
Fecha de Ingreso: febrero-2005
Ubicación: Lima
Mensajes: 481
Antigüedad: 19 años, 2 meses
Puntos: 4
Re: Manejo De Arrays De Cajas De Texto Con Hiperenlaces

Hola EDWINSANCHEZ bueno creo q el problema en tu caso es javascript.

ahi coloque una funcion que te muestra de de muestra en un alert el valor de el valor de cada cuadro de texto; claro que si quieres procesarlo puedes hacer un location y pasar el valor por GET.
Código PHP:
<script>
function obt_val(nro){
    alert("Valor de " + document.getElementById('txtdescArticulo['+ nro +']').value);
}
</script>
<form name="opt" method="post" action="#">
<table border="2" align="center" bordercolor="#ECE9D8">
<tr>
<th>Artículo</th>
<th>Descripción</th>
<th>Centro de Costos</th>
<th>Cantidad</th>
<th>Precio</th>
<th>Impuesto</th>
<th>Importe</th>
<th>Total</th>
</tr>
<?php
$txtNroProductos 
5;
for (
$i=0;$i<$txtNroProductos;$i++)
{
?>
<tr>
<td height="22" width="20" bordercolordark="#454560"><input type="text" size="10" name="txtidArticulo[]">
</td>
<td height="22"><input type="text" name="txtdescArticulo[]" id="txtdescArticulo[<?php echo $i?>]"><a href="javascript: obt_val(<?php echo $i?>)">Ayuda</a></td>

<td height="22" width="20"><input type="text" size="10" name="txtvccArticulo[]"></td>
<td height="22" width="20"><input type="text" size="10" name="txtcantArticulo[]"></td>
<td height="22" width="20"><input type="text" size="10" name="txtprecioArticulo[]"></td>
<td height="22" width="20"><input type="text" size="10" name="txtimpuestoArticulo[]"></td>
<td height="22" width="20"><input type="text" size="10" name="txtimporteArticulo[]"></td>
<td height="22" width="20"><input type="text" size="10" name="txttotalArticulo[]"></td>
</tr>
<?php
}
?>
</table >
</form>
Espero que de utilidad.

Saludos
__________________

  #10 (permalink)  
Antiguo 16/04/2007, 12:47
 
Fecha de Ingreso: octubre-2006
Mensajes: 79
Antigüedad: 17 años, 6 meses
Puntos: 0
Re: Manejo De Arrays De Cajas De Texto Con Hiperenlaces

Si Quiero Procesarlo,como Usaria El Location Y El Get?????
  #11 (permalink)  
Antiguo 17/04/2007, 08:28
Avatar de cala932  
Fecha de Ingreso: septiembre-2006
Ubicación: San Juan-Argentina
Mensajes: 902
Antigüedad: 17 años, 7 meses
Puntos: 9
Re: Manejo De Arrays De Cajas De Texto Con Hiperenlaces

Hola, te pongo un ejemplo para enviar variables:
Código PHP:
echo"
<td><a href='http://"
.$_SERVER["HTTP_HOST"]."/tupagina.php?id=$ID'>"
Para recibirla:
Código PHP:
$_GET['id']; 
Con los header seria asi:
Código PHP:
header("Location: http://".$_SERVER["HTTP_HOST"]."/tupagina.php?id=$ID");
//y la recibes como en el caso anterior 
__________________
->Aprender es un proceso que incluye el error..
  #12 (permalink)  
Antiguo 17/04/2007, 10:10
 
Fecha de Ingreso: octubre-2006
Mensajes: 79
Antigüedad: 17 años, 6 meses
Puntos: 0
Re: Manejo De Arrays De Cajas De Texto Con Hiperenlaces

Pero Para Usarlo En La Parte De Codigo Ultimo Que Proporcione,como Lo Utilizaria????.
  #13 (permalink)  
Antiguo 17/04/2007, 10:11
 
Fecha de Ingreso: octubre-2006
Mensajes: 79
Antigüedad: 17 años, 6 meses
Puntos: 0
Re: Manejo De Arrays De Cajas De Texto Con Hiperenlaces

PERDON EN ESTE CODIGO, QUE ES IGUAL A QUE ME BRINDO GERSON?..


<script>
function obt_val(nro){
alert("Valor de " + document.getElementById('txtdescArticulo['+ nro +']').value);
}
</script>
<form name="opt" method="post" action="#">
<table border="2" align="center" bordercolor="#ECE9D8">
<tr>
<th>Artículo</th>
<th>Descripción</th>
<th>Centro de Costos</th>
<th>Cantidad</th>
<th>Precio</th>
<th>Impuesto</th>
<th>Importe</th>
<th>Total</th>
</tr>
<?php
$txtNroProductos = 5;
for ($i=0;$i<$txtNroProductos;$i++)
{?>
<tr>
<td height="22" width="20" bordercolordark="#454560"><input type="text" size="10" name="txtidArticulo[]">
</td>
<td height="22"><input type="text" name="txtdescArticulo[]" id="txtdescArticulo[<?php echo $i?>]"><a href="javascript: obt_val(<?php echo $i?>)">Ayuda</a></td>

<td height="22" width="20"><input type="text" size="10" name="txtvccArticulo[]"></td>
<td height="22" width="20"><input type="text" size="10" name="txtcantArticulo[]"></td>
<td height="22" width="20"><input type="text" size="10" name="txtprecioArticulo[]"></td>
<td height="22" width="20"><input type="text" size="10" name="txtimpuestoArticulo[]"></td>
<td height="22" width="20"><input type="text" size="10" name="txtimporteArticulo[]"></td>
<td height="22" width="20"><input type="text" size="10" name="txttotalArticulo[]"></td>
</tr>
<?php
}
?>
</table >
</form>
  #14 (permalink)  
Antiguo 17/04/2007, 11:38
Avatar de gerson  
Fecha de Ingreso: febrero-2005
Ubicación: Lima
Mensajes: 481
Antigüedad: 19 años, 2 meses
Puntos: 4
Re: Manejo De Arrays De Cajas De Texto Con Hiperenlaces

Hola EDWINSANCHEZ bueno con respecto al redireccionamiento el la funcion del javascript seria asi:
Código HTML:
 <script>
function obt_val(nro){    
    window.location.href="ayuda.php?valor=" + document.getElementById('txtdescArticulo['+ nro +']').value
}
</script> 
Lo q hace esta funcion es redireccionar a otro archivo con una variable "valor" el cual esta asignado el valor del cuadro de texto del cual se linkeo.

Espero te ayude esto

Saludos
__________________

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




La zona horaria es GMT -6. Ahora son las 03:43.