<?php
error_reporting(-1); // -1 = alle Bits gesetzt, alle Fehler anzeigen
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Pizza da Mamma</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="../css/style.css" />
</head>
<body>
<div id="header">
<img src="../images/logo/171x37.png" alt="" width="171" height="37" />
<div class="small">
<a href="../index.html"><img src="../images/small1.gif" alt="" width="13" height="13" /></a>
<a href="../html/überuns.html"><img src="../images/small2.gif" alt="" width="16" height="13" /></a>
<a href="mailto:[email protected]"><img src="../images/small3.gif" alt="" width="16" height="13" /></a>
</div>
</div>
<div class="menu">
<img src="../images/lefttop.png" alt="" width="37" height="56" />
<ul>
<li><a href="../index.html" ><img src="../images/but1.gif.png" alt="" onmouseover="this.src='../images/but1_hover.gif.png';" onmouseout="this.src='../images/but1.gif.png'" width="109" height="30" /></a></li>
<li><a href="../html/überuns.html"><img src="../images/but2.gif.png" alt="" onmouseover="this.src='../images/but2_hover.gif.png';" onmouseout="this.src='../images/but2.gif.png'" width="109" height="30" /></a></li>
<li><a href="../html/sortiment.html"><img src="../images/but3.gif.png" alt="" onmouseover="this.src='../images/but3_hover.gif.png';" onmouseout="this.src='../images/but3.gif.png'" width="109" height="30" /></a></li>
<li><a href="bestellung.php"><img src="../images/but5_active.png" alt="" onmouseover="this.src='../images/but5_hover.png';" onmouseout="this.src='../images/but5_active.png'" width="109" height="30" /></a></li>
<li><a href="../html/standort.html"><img src="../images/but4.gif.png" alt="" onmouseover="this.src='../images/but4_hover.gif.png';" onmouseout="this.src='../images/but4.gif.png'" width="108" height="30" /></a></li>
</ul>
</div>
<div id="phpcontent"><br><br>
<div id="notizen">
<?
/*
karte.txt
1;Pizza Margerita;pizza;8.50,9.30;25cm,30cm
2;Pizza Schinken;pizza;6.25;25cm
3;Calzone del'fungie;pizza;7.65,8.97,12.33;25cm,30cm,42cm
4;Pizza Salami;pizza;8.25;25cm
*/
$karte_array = array();
$zeilen = file ("karte.txt");
foreach ($zeilen as $zeile) {
list($id,$name,$gruppe,$preis,$einheit) = explode(";", $zeile);
$preis_array=explode(",", $preis);
$preisanzahl=count($preis_array);
$einheit_array=explode(",", $einheit);
$karte_array[$id]=$name;
# in SESSION speichern nach Senden
if(isset($_POST[$id."_notizen"]) && $_POST[$id."_notizen"]!=""){
$_SESSION["KORB"][$id."_".time()] = $_POST[$id."_notizen"];
$_SESSION["KORB_preis"][$id."_".time()] = $_POST[$id."_preis"];
}
$outputradio="";
if($preisanzahl == "1"){
$outputradio="<input type='radio' name='".$id."_preis' value='".$preis."'>".$preis."/".$einheit."<br>";
}else{
for($i=0; $i < count($preis_array);$i++){
$outputradio.="<input type='radio' name='".$id."_preis' value='".$preis_array[$i]."|".$einheit_array[$i]."'>".$preis_array[$i]."/".$einheit_array[$i]."<br>";
}
}
echo '<form action="#" method="post" name="form">';
echo "".$id.". ".$name."<br>";
#echo $name.' ('.$preis.' CHF) zur Bestellung hinzufügen<br>';
echo '<input type="text" style="border:1px solid black; width:20px" maxlength="2" name="'.$id.'_notizen" value=""><br>';
echo $outputradio;
#echo '<input type="radio" name="'.$id.'_preis" value="11">1';
#echo '<input type="radio" name="'.$id.'_preis" value="22">2';
echo ' <input type="submit" class="formbutton" style="width:180px" value="Anzahl speichern"></form> ';
}
?>
</div>
<div id="notizen_anzeigen">
<center><b>DEIN WARENKORB</b><br /></center><br>
<?php
# unset($_SESSION["KORB"]);
if(isset($_SESSION["KORB"])){
echo "<small>";
# alle Daten aus SESSION Anzeigen
ksort ($_SESSION["KORB"]);
ksort ($_SESSION["KORB_preis"]);
$preisges="";
foreach($_SESSION["KORB"] as $key => $value){
list($PREIS,$EINHEIT) = explode("|", $_SESSION['KORB_preis'][$key]);
$preis =($value*$PREIS);
echo
$karte_array[trim(preg_replace('/_[\d]*$/', ' ', $key))]."
".$EINHEIT
#$key
.": ".$value." x ".$PREIS." = ".number_format($preis, 2, '.', '');
echo "<br>";
$preisges+=$preis;
}
echo "<br>";
echo "<hr />";
echo "Total: ".number_format($preisges, 2, '.', '')." CHF</small>";
}else{
echo "Dein Warenkorb ist leer<br>";
}
?>
<br><br><center>
<form action="#" method="post" name="form">
<input type="submit" class="formbutton" value="Anfrage erstellen zum Formular" /></form><br /></center>
</div>
</div>
<div id="footer">
© 2010 Pizza da Mamma. All rights reserved
</div>
<?php
print_r($_SESSION);
?>
</body>
</html>