| Usuario |
coger value de text a variable php |
Desconocido
|
| Enviado - 9/6/2006 |
| |
Hola, tengo la siguiente duda.
while(OCIFetch($stid))
{ $id=ociresult($stid,1);
$precio=ociresult($stid,2);
$nombre=ociresult($stid,3);
$descripcion=ociresult($stid,4);
$proveedor=ociresult($stid,5);
?>
<span class="Normal">
<table border="0">
<tr>
<td width="130"><? echo $nombre; ?></td>
<td width="250"><? echo $descripcion; ?></td>
<td width="130"><? echo $precio; ?></td>
<form method="post" action="<? echo $PHP_SELF ?>">
<td width="20" align="left"><input name="cantidad" id="cantidad" type="text" value="1" size="3" maxlength="3"/></td>
</form>
<?
YO AQUI QUIERO COGER EN LA VARIABLE $cantidad EL VALUE DEL INPUT "cantidad", COMO LO HAGO?
PQ LUEGO MANDO LA CANTIDAD Y EL RESTO DE VARIBALE MEDIANTE LA ETIQUETA <a>
?>
<td width="70" align="right">
<? echo "<a href='mete_producto.php?id=$id&nombre=$nombre&precio=$precio&cantidad=$cantidad' target='carro'> Agregar </a>" ?>
</td>
</tr>
</table>
</span>
Si alguien puede ayudarme se lo agradeceria muchismo. :S
|
| |
|
jonasin
131 Mensaje(s)
|
| Enviado - 11/6/2006 |
| |
Hola, mira para recoger la variable de tu input, usas el metodo $_REQUEST
$_REQUEST["cantidad"];
de esta manera vas a poder disponer del valor q escribas en el input, ahora como tu estas mandando llamar la misma pagina para hacer el proceso, tienes que validaar si la variable existe antes de todo( ya que la primera vez no existe valor), para que no te vaya a marcar error, de la siguiente manera:
if( isset($_REQUEST["cantidad"]) ){
//codigo existe variable
}else{
//codigo no existe variable
}
con isset() puedes checar el valor de cada variable sin que haya riesgo de error. |
| |
|
|
|