Aqui lo teneis:
Código PHP:
if(isset($_POST["temp"])){ // Si hemos seleccionado algun extra, lo añadimos a la variable de sesion
$temp = $_POST["temp"];
for ($i = 0; $i < sizeof($temp); $i++) {
$_SESSION["extras_escogidos"][] = $temp[$i]; // Al no poner indice, añade el elemento al final del array
}
}
<form name="form" method="post" action="escoger_extras.php">
$sql = "select * from extra";
$res = mysql_query($sql);
while($array = mysql_fetch_row($res) ){
echo "Añadir <input type=\"checkbox\" name=\"temp[]\" value=\"$array[0]\" >";
<input type="submit" name="submit" value="Añadir al carrito"/>
</form>
Saludos!