Ik zei niks hoor(ik typte alleen hahahahah);
Link gekopieerd
M
Mitch X
13-10-2004 20:19
gewijzigd op 13-10-2004 20:19
greedyxl schreef op 13.10.2004 19:52
zo:
<?php
$mandje=$_SESSION['winkelmand']);
foreach ($mandje as $key => $value) {
echo $key': '.$value.'<br>';
}
?>
zo kan het volgens mij.
<?php
foreach($_SESSION['winkelmand'] as $mandje)
foreach($mandje as $key => $value)
echo $key . ' geeft ' . $value . '<br />';
?>
Link gekopieerd
hey, dit werkt perfect man :D, alleen nog een probleempje hij echo'd $ID niet? hoe kan ik zorgen dat ie dat wel doet?
Link gekopieerd
hehe je zeurt nogal he? :P
Wat geeft ie psies terug?
Link gekopieerd
wacht ik heb het al in voegtoe.php:
$winkelmandje[$ID] = array("ID" => $ID, "Naam" => $Naam,"Totaalprijs"=> $Totaalprijs);
nog ff erin zetten :D
Link gekopieerd
Nu doet ie het perfect, bedankt allemaal.
Zeurde ik zo erg?? :P
Link gekopieerd
Dus het script werkte wel, alleen jij deed het niet goed :P
En ja, je zeurde ;)
Link gekopieerd
Nou moet ik toch even terugkomen hierop, dit werkt wel maar ik wil dus van bijvoorbeeld ID 1 de daarbij behorende Naam en totaalprijs in aparte cellen laten zien in deze code:
echo"<tr>
<td bgcolor='#CCD1DE' width='17%' align='center'><b><font face='Arial' size='1' color='#3A4E7C'>
$ID</font></b></td>
<td bgcolor='#CCD1DE' width='11%' align='center'><b>
<font face='Arial' size='1' color='#3A4E7C'>$Naam</font></b></td>
<td bgcolor='#CCD1DE' width='10%' align='center'><b>
<font face='Arial' size='1' color='#3A4E7C'>$Maat</font></b></td>
<td bgcolor='#CCD1DE' width='10%' align='center'><b>
<font face='Arial' size='1' color='#3A4E7C'>$Aantal</font></b></td>
<td bgcolor='#CCD1DE' width='9%' align='center'><b>
<font face='Arial' size='1' color='#3A4E7C'>$Prijs</font></b></td>
<td bgcolor='#CCD1DE' width='20%' align='center'><b>
<font face='Arial' size='1' color='#3A4E7C'>$Voorbeeld</font></b></td>
<td bgcolor='#CCD1DE' width='19%' align='center'><b>
<font face='Arial' size='1' color='#3A4E7C'>$Totaalprijs</font></b></td>
</tr>";
Maar hoe kan dat met foreach? want dan zet ie het gewon achter elkaar zoals dit: 1MisterX15
Link gekopieerd
NU doe ik het zo:
echo'<tr>
<td bgcolor="#CCD1DE" width="17%" align="center"><b><font face="Arial" size="1" color="#3A4E7C">
'.$key . ' geeft ' . $value . '/font></b></td>
<td bgcolor="#CCD1DE" width="11%" align="center"><b>
<font face="Arial" size="1" color="#3A4E7C"></font></b></td>
<td bgcolor="#CCD1DE" width="10%" align="center"><b>
<font face="Arial" size="1" color="#3A4E7C"></font></b></td>
<td bgcolor="#CCD1DE" width="10%" align="center"><b>
<font face="Arial" size="1" color="#3A4E7C"></font></b></td>
<td bgcolor="#CCD1DE" width="9%" align="center"><b>
<font face="Arial" size="1" color="#3A4E7C"></font></b></td>
<td bgcolor="#CCD1DE" width="20%" align="center"><b>
<font face="Arial" size="1" color="#3A4E7C"></font></b></td>
<td bgcolor="#CCD1DE" width="19%" align="center"><b>
<font face="Arial" size="1" color="#3A4E7C"></font></b></td>
</tr>';
Maar dan zet ie alle gegevens steeds in een nieuwe cel onder elkaar, en het moet naast elkaar... wie kan me aub helpen?
Link gekopieerd