coger value de text a variable php
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
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
Y en vez de usar un link porque no utilizas un form en get ?
<form action='mete_producto.php' method='get'>
y pones todos los datos en input's hidden.
asi podrias enviarla mas facilmente...
Incluso es mas, para "mayor" seguridad, podrias intentar enviar por get solo una variable que te indique q estas agregando el producto y lo demas en post, me explico.
<form action='mete_producto.php?etapa=ingreso' method='POST'>
y dentro del form ingresas todos los datos en hidden asi solo tienes que mostrarselos como texto al usuario y le pones un input text para la cantidad.
Suerte !
<form action='mete_producto.php' method='get'>
y pones todos los datos en input's hidden.
asi podrias enviarla mas facilmente...
Incluso es mas, para "mayor" seguridad, podrias intentar enviar por get solo una variable que te indique q estas agregando el producto y lo demas en post, me explico.
<form action='mete_producto.php?etapa=ingreso' method='POST'>
y dentro del form ingresas todos los datos en hidden asi solo tienes que mostrarselos como texto al usuario y le pones un input text para la cantidad.
Suerte !
Asi lo e probado, pero cada vez q pincho en el boton de agregar haciendolo por medio de formulario no me funciona bien el tinglao, entonces si puedo hacerlo de esta manera pues mejor, pero gracias de todas formas :)