Carrocompra.php obtiene los valores de id, nombre, precio y stock mediante post porque tengo los artículos guardados en una BD y son obtenidos mediante esta funcion:
Código PHP:
function llistarcategoria1(){ //categoria1=pernils
bdproductes();
$sql = "SELECT * FROM productes WHERE categoria = 'Pernils'";
$resultado = mysql_query($sql);
while($row = mysql_fetch_row($resultado)){
$row[0];
$row[1];
$row[2];
$row[3];
$row[4];
echo'<table width="600" border="1">
<tr>
<td width="250" rowspan="5"> </td>
<td width="350">'.$row[1].'</td>
</tr>
<tr>
<td>Stock:'.$row[4].'</td>
</tr>
<tr>
<td>Preu: '.$row[3].'Euros</td>
</tr>
<tr>
<td> <form action="carrocompra.php" method="post">
<input name="quantitat" type="text" value="1" size="6" maxlength="3" />
<input name="id" type="hidden" value="'.$row[0].'"" />
<input name="nom" type="hidden" value="'.$row[1].'"" />
<input name="preu" type="hidden" value="'.$row[3].'"" />
<input name="stock" type="hidden" value="'.$row[4].'"" /><input value="Afegir al carret" type="submit" /></form></td>
</tr>
</table>';
}
}