Haber si mexplico mejor y me ayudais...
en este codigo me muestra una tabla con todos los articulos. y al lado un texto para q introduzcan la cantidad q quieren.
Código PHP:
?>
<script language="JavaScript">
function envia(){
document.form1.submit();
}
function comprovar() {
if (isNaN(document.form1.quantitat.value) && document.form1.quantitat.value != "") {
alert("HAS D'INTRODUIR UN VALOR NUMÈRIC. RECORDA QUE LA COMA ÉS EL PUNT.");
document.form1.quantitat.focus();
document.form1.quantitat.value = "";
}
}
</script>
<html>
<head>
<link href="../../../../Style/Style.css" rel="stylesheet" type="text/css">
</head>
<body class="fondo">
<form name="form1" method="post" action="index.php?fuseaction=new">
<table width="75%"align="center" cellspacing=0 cellpadding=0 bgcolor="#CCCCCC" border=0>
<tr>
<td height="10px" width="10px"></td>
<td height="10px" align="left">
<p align="left"><a href="index.php?fuseaction=list"><img src="../../../../img/sortir.gif" width="91" height="25" border="0"></a></p>
</td>
<td height="10px" align="right">
<p align="right"><a href="javascript:envia();"><img src="../../../../img/continuar.gif" width="91" height="25" border="0"></a></p>
</td>
<td height="10px" width="10px"></td>
</tr>
<tr>
<td height="10px" width="10px"></td>
<td align="center" colspan="2"><font size="3"><strong>Comandes</strong></font><p></p>
<table width="75%" cellpadding="0" cellspacing="0" class="list">
<tr>
<td align="left" class="listheader">Codi</td>
<td align="center" class="listheader">Article</td>
<td align="center" class="listheader">Quantitat</td>
</tr>
<? if ($rc_list_comanda == 0)
echo "<tr><td colspan=3 class=listitem>No hi ha resultats.</td></tr>";
for($cr_list_comanda=0;$row_list_comanda=mysql_fetch_array($qry_list_comanda);$cr_list_comanda++){
echo "<tr>";
echo "<td align='left' class=listitem>".$row_list_comanda[codiarticle]."</td>";
echo "<td align='left' class=listitem>".$row_list_comanda[nom_article]."</td>";
?>
<input type='hidden' name='max' value='<? echo($rc_list_comanda) ?>'>
<input type='hidden' name='idarticle' value='<? echo($row_list_comanda[codiarticle]) ?>'>
<td align=center width=10% class=listitem><input type='text' name='quantitat'></td>
<?
echo "</tr>";
}
?>
</table>
</td>
<td height="10px" width="10px"></td>
</tr>
<tr>
<td width=100 colspan="4" height="15px" align="center"></td>
</tr>
</table>
</form>
</body>
</html>
ellos pueden poner o no alguna cantidad...
en la otra pagina tengo q recoger los valores los cuales la persona haya introducido alguna cantidad...
ser q tengo q hacer una matriz bidimensional pero no se como assignar los valores a la matriz...
la matriz la tengo q llenar con el codigo del articulo y la cantidad q le ha asigando la persona.
Algo rollo esto xo q pueda discrimnar los valores q me pasan....
Código PHP:
$max = $_POST['max'];// variable amb el tope de la consulta
$max=$max-1;
$reg = 0;
$reg1 =1;
$carrito=array();
while ($reg <= $max) {
$i = list ($Key, $Value) = each($_POST['idarticle']);
$i1 = list ($Key1, $Value1) = each($_POST['quantitat']);
$carrito[$reg][$reg] = $Value;
$carrito[$reg][$reg1] = $Value1;
$reg++;
$reg1++;
}
Disculpen mi poca experiencia con arrays y matrices..
Gracias de antemano...