• Jetzt anmelden. Es dauert nur 2 Minuten und ist kostenlos!

Probleme mit dem Navi

Werbung:
Hey Cheffchen

Vielen Dank für die Änderungen, haben mir wirklich geholfen und zu;
Der warenkorb funktioniert soweit noch nur müsste halt beim Anzeigen aus die ID wieder der Name werden und vom preis array der zweite teil da rann das man sieht (normal, gross, famely). Aber dafür jetzt keine zeit.
das werde ich mir morgen anschauen, heute gerade wenig Zeit - aber vielen Dank!

Gruss
 
Hallo Cheffchen

Ich habe jetzt den Code angeschaut und bearbeitet, sodass es für mich optimal wäre:
PHP:
<?php
#error_reporting(-1); // -1 = alle Bits gesetzt, alle Fehler anzeigen
session_start();
?>
<!DOCtypeE 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-typee" content="text/html; charset=iso-8859-1" />
 <link rel="stylesheet" typee="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;(klein),(gross)
   2;Pizza Schinken;pizza;6.25,11.90;(klein),(gross)
   3;Calzone del'fungie;pizza;7.65,8.97;(klein),(gross)
   4;Pizza Salami;pizza;8.00,12.23;(klein),(gross)
   */
   $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 '&nbsp; <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">
  &copy; 2010 Pizza da Mamma.  All rights reserved
 </div>
 <map name="Map" id="Map">
  <area shape="rect" coords="110,2,128,63" href="#" />
 </map>
 <map name="Map2" id="Map2">
  <area shape="rect" coords="109,1,126,65" href="#" />
 </map>
 <map name="Map3" id="Map3">
  <area shape="rect" coords="111,2,127,67" href="#" />
 </map>
 <map name="Map4" id="Map4">
  <area shape="rect" coords="112,0,128,64" href="#" />
 </map>
<?php
#print_r($_SESSION);
?>
</body>
</html>
Aber jetzt noch eine Frage, gäbe es eine Möglichkeit, etwas aus dem Warenkorb zu entfernen, bzw. ein Knopf (radio) bei dem ich anklicken kann und dann unten dran an Total oder irgendwo dort einen Knopf wenn ich den klicke löscht es das Ausgewählte?

Wäre nett wenn du mir nochmals helfen könntest :-)

Gruss

PS: Bin gerade am mail bauen, dass ich mir die Sachen per Mail schicken kann.
 
Werbung:
Hallo,

habe ich mir schon gedacht [-] [+] :O)
Sonst ist nichts geändert.

PHP:
<?php
#error_reporting(-1); // -1 = alle Bits gesetzt, alle Fehler anzeigen
session_start();
?>
<!DOCtypeE 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-typee" content="text/html; charset=iso-8859-1" />
 <link rel="stylesheet" typee="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;(klein),(gross)
   2;Pizza Schinken;pizza;6.25,11.90;(klein),(gross)
   3;Calzone del'fungie;pizza;7.65,8.97;(klein),(gross)
   4;Pizza Salami;pizza;8.00,12.23;(klein),(gross)
   */
   $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 '&nbsp; <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"])){
                 #############################
                 # Warenkorb +/- verarbeitung
          if(isset($_GET['key']) && isset($_GET['plus'])){
           $_SESSION["KORB"][$_GET['key']]=($_SESSION["KORB"][$_GET['key']]+1);
          }elseif(isset($_GET['key']) && isset($_GET['minus'])){
                         $_SESSION["KORB"][$_GET['key']]=($_SESSION["KORB"][$_GET['key']]-1);
                         if($_SESSION["KORB"][$_GET['key']]=='0'){
                          unset($_SESSION["KORB"][$_GET['key']]);
                         }
                  }
                 # Warenkorb +/- verarbeitung
                 #############################
         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 "
          <a style='text-decoration:none' href='?key=".$key."&amp;minus'>[-]</a>
          <a style='text-decoration:none' href='?key=".$key."&amp;plus'>[+]</a><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">
  &copy; 2010 Pizza da Mamma.  All rights reserved
 </div>
 <map name="Map" id="Map">
  <area shape="rect" coords="110,2,128,63" href="#" />
 </map>
 <map name="Map2" id="Map2">
  <area shape="rect" coords="109,1,126,65" href="#" />
 </map>
 <map name="Map3" id="Map3">
  <area shape="rect" coords="111,2,127,67" href="#" />
 </map>
 <map name="Map4" id="Map4">
  <area shape="rect" coords="112,0,128,64" href="#" />
 </map>
 <pre>
<?php
print_r($_GET);
print_r($_SESSION);
?>
</pre>
</body>
</html>
Cheffchen
 
Hallo Cheffchen

Vielen Dank für die Änderungen! BTW ich hab noch den Code mit # ausgeblendet, der auf der Site angezeigt wird.

Leider bekomme ich eine Fehlermeldung, wenn ich z.B. 3 Pizzas im Warenkorb habe und dann "-" klicke, bis es 0 wird. Bei 0 kommt die folgende Fehlermeldung:
Warning: number_format() expects parameter 1 to be double, string given in C:\xampp\htdocs\Alex\php\bestellung.php on line 110

An was liegt das? Könnte man nicht noch ein "x" machen, so dass einfach alle 3 Pizza Margerita auf einmal gelöscht werden? Dann hätte man plus eine, minus eine, oder einfach alle weg mit x.

PHP:
<?php
#error_reporting(-1); // -1 = alle Bits gesetzt, alle Fehler anzeigen
session_start();
?>
<!DOCtypeE 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-typee" content="text/html; charset=iso-8859-1" />
 <link rel="stylesheet" typee="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;(klein),(gross)
    2;Pizza Schinken;pizza;6.25,11.90;(klein),(gross)
    3;Calzone del'fungie;pizza;7.65,8.97;(klein),(gross)
    4;Pizza Salami;pizza;8.00,12.23;(klein),(gross)
    */
    $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 '&nbsp; <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"])){
      #############################
      # Warenkorb +/- verarbeitung
     if(isset($_GET['key']) && isset($_GET['plus'])){
      $_SESSION["KORB"][$_GET['key']]=($_SESSION["KORB"][$_GET['key']]+1);
     }elseif(isset($_GET['key']) && isset($_GET['minus'])){
        $_SESSION["KORB"][$_GET['key']]=($_SESSION["KORB"][$_GET['key']]-1);
        if($_SESSION["KORB"][$_GET['key']]=='0'){
         unset($_SESSION["KORB"][$_GET['key']]);
        }
       }
      # Warenkorb +/- verarbeitung
      #############################
    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 "
     <a style='text-decoration:none' href='?key=".$key."&amp;minus'>[-]</a>
     <a style='text-decoration:none' href='?key=".$key."&amp;plus'>[+]</a><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="Bestellung abschicken" /></form><br /></center>
  </div>
 </div>
 <div id="footer">
  &copy; 2010 Pizza da Mamma.  All rights reserved
 </div>
 <map name="Map" id="Map">
  <area shape="rect" coords="110,2,128,63" href="#" />
 </map>
 <map name="Map2" id="Map2">
  <area shape="rect" coords="109,1,126,65" href="#" />
 </map>
 <map name="Map3" id="Map3">
  <area shape="rect" coords="111,2,127,67" href="#" />
 </map>
 <map name="Map4" id="Map4">
  <area shape="rect" coords="112,0,128,64" href="#" />
 </map>
 <pre>
<?php
#rint_r($_GET);
#print_r($_SESSION);
?>
</pre>
</body>
</html>

Das hast du dir aber sicher auch schon gedacht :O :p

Gruss
 
Hallo,

ja schon aber keine zeit, das ist aber nichts wildes da + und - schon da, mach das Morgen.

Warning: number_format() expects parameter 1 to be double, string given in C:\xampp\htdocs\Alex\php\bestellung.php on line 110
Das dürfte nicht am code selber liegen da der bei mir 100% funzt auch mit error on.
Ich denke mal eher an der karte.txt die Ausgelessen wird. Die Struktur bzw. Format ist sehr wichtig da darauf der php code darauf aufbaut.
Wie sieht der Preis dieser Pizza in der txt aus, wie der code in der php datei?
/*
karte.txt
1;Pizza Margerita;pizza;8.50,9.30;(klein),(gross)
2;Pizza Schinken;pizza;6.25,11.90;(klein),(gross)
3;Calzone del'fungie;pizza;7.65,8.97;(klein),(gross)
4;Pizza Salami;pizza;8.00,12.23;(klein),(gross)
*/

Cheffchen
 
Werbung:
Hallo Cheffchen

Ich verstehe nicht ganz, was du meinst
Wie sieht der Preis dieser Pizza in der txt aus, wie der code in der php datei?
Irgendwie sieht ja das genau gleich aus, auch den Punkt zwischen Einerstelle und Dezimalzahlen und die zwei Dezimalstellen werden exakt gleich angezeigt. Und das file wird falsch ausgelesen. Es wird ja Zeile für Zeile und dann schön der Reihenfolge nach - zuerst id, dann name, gruppe, preis, einheit. <-- Hier liest es ja auch das richtige aus.
/\
|
|
Aber eigentlich ist das ja nicht sonderlich wichtig, wenn man das [x] hat, dass einfach alle z.B. drei Pizza Margherita auf einmal weg nimmt, weil dann kommt man auch nicht in den minus-bereich. Wäre halt ein Schönheitsfehler.

Gruss
 
Hallo,

das mit dem fehler hat sich hoffentlich mit einer kleinen änderungen hier jetzt geklärt.
Hier mit x :O)
und zeile 50 kannst ändern wenn nicht alle sondern nur eine bestimmt grupper Anzeigen möchtest (pizza oder alk). siehe beispiel karte.txt
PHP:
<?php
error_reporting(-1); // -1 = alle Bits gesetzt, alle Fehler anzeigen
session_start();
?>
<!DOCtypeE 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-typee" content="text/html; charset=iso-8859-1" />
 <link rel="stylesheet" typee="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;(klein),(gross)
 2;Pizza Schinken;pizza;6.25,11.90;(klein),(gross)
 3;Calzone del'fungie;pizza;7.65,8.97;(klein),(gross)
 4;Bier;alk;3.00,5.55,8.99;0.25l,0.75l,1.00l
 5;Pizza Salami;pizza;8.00,12.23;(klein),(gross)
    */
    $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;
         if($gruppe==$gruppe){ #if($gruppe=="pizza"){ wenn nur eine bestimmt gruppe angezeigt werden soll
          # 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." 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 '&nbsp; <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"])){
      #############################
      # Warenkorb +/- verarbeitung
     if(isset($_GET["key"]) && isset($_GET["plus"])){
      $_SESSION["KORB"][$_GET["key"]]=($_SESSION["KORB"][$_GET["key"]]+1);
     }elseif(isset($_GET["key"]) && isset($_GET["minus"])){
        $_SESSION["KORB"][$_GET["key"]]=((float)$_SESSION["KORB"][$_GET["key"]]-1);
        if($_SESSION["KORB"][$_GET["key"]]<"1"){
         unset($_SESSION["KORB"][$_GET["key"]]);
        }
     }elseif(isset($_GET["key"]) && isset($_GET["raus"])){
        unset($_SESSION["KORB"][$_GET["key"]]);
     }
      # Warenkorb +/- verarbeitung
      #############################
    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 "
     <a style='text-decoration:none' href='?key=".$key."&amp;minus'>[-]</a>
     <a style='text-decoration:none' href='?key=".$key."&amp;plus'>[+]</a>
     <a style='text-decoration:none' href='?key=".$key."&amp;raus'>[x]</a>
     <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="Bestellung abschicken" /></form><br /></center>
  </div>
 </div>
 <div id="footer">
  &copy; 2010 Pizza da Mamma.  All rights reserved
 </div>
 <map name="Map" id="Map">
  <area shape="rect" coords="110,2,128,63" href="#" />
 </map>
 <map name="Map2" id="Map2">
  <area shape="rect" coords="109,1,126,65" href="#" />
 </map>
 <map name="Map3" id="Map3">
  <area shape="rect" coords="111,2,127,67" href="#" />
 </map>
 <map name="Map4" id="Map4">
  <area shape="rect" coords="112,0,128,64" href="#" />
 </map>
 <pre>
<?php
#rint_r($_GET);
#print_r($_SESSION);
?>
</pre>
</body>
</html>
Cheffchen
 
Hmm du bringst mich auf eine spitzen Idee Cheffchen! Ich könnte ja neue Knöpfe machen mit den Kategorien und dann zwischen denen flippen während ich am auswählen bin, zuerst PIzza wählen dann druck auf Knopf Getränke, dann dort die Getränke auswählen, etc. :-)
Nur die eine Frage, bleibt der Warenkorb mit den bisherigen Produkten immer gleich auch wenn ich die Sites wechsle? Wenn ja, dann mache ich gleich neue Knöpfe :twisted: ^^

Vielen Dank und einen schönen Abend
 
Werbung:
Hallo,
du bringst mich auf eine spitzen Idee Cheffchen
Deswegen hatte ich das ja schon so eingeplant :O).
Warenkorb bleibt bestehen.
Ja du könntest oben eine art untermenü machen
Code:
**
<a href="?anzeige=pizza">Pizza</a>
<a href="?anzeige=alk">Suff</a>
....
dann die Zeile 50 mit der gruppe (if($gruppe==$gruppe){) so ändern
Code:
if((isset($_GET['anzeige']) && $gruppe == $_GET['anzeige']) || (!isset($_GET['anzeige']) && $gruppe == $gruppe)){

Cheffchen
 
Hallo Cheffchen

So, habe neue Knöpfe gemacht, die Seiten verlinkt und das txt-file erweitert. Hier der Code:
PHP:
<?php
error_reporting(-1); // -1 = alle Bits gesetzt, alle Fehler anzeigen
session_start();
?>
<!DOCtypeE 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-typee" content="text/html; charset=iso-8859-1" />
 <link rel="stylesheet" typee="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="bestellungmenu">
     <ul>
    <li><a href="bestellung_pizza.php" ><img src="../images/butpizza_active.png" alt="" onmouseover="this.src='../images/butpizza_hover.png';" onmouseout="this.src='../images/butpizza_active.png'" width="109" height="30" /></a></li>
  </ul>
     <ul>
    <li><a href="bestellung_pasta.php" ><img src="../images/butpasta.png" alt="" onmouseover="this.src='../images/butpasta_hover.png';" onmouseout="this.src='../images/butpasta.png'" width="109" height="30" /></a></li>
  </ul>
     <ul>
    <li><a href="bestellung_spezialitäten.php" ><img src="../images/butspezialitäten.png" alt="" onmouseover="this.src='../images/butspezialitäten_hover.png';" onmouseout="this.src='../images/butspezialitäten.png'" width="109" height="30" /></a></li>
  </ul>
     <ul>
    <li><a href="bestellung_getränke.php" ><img src="../images/butgetränke.png" alt="" onmouseover="this.src='../images/butgetränke_hover.png';" onmouseout="this.src='../images/butgetränke.png'" width="109" height="30" /></a></li>
  </ul>
     <ul>
    <li><a href="bestellung_insalate.php" ><img src="../images/butinsalate.png" alt="" onmouseover="this.src='../images/butinsalate_hover.png';" onmouseout="this.src='../images/butinsalate.png'" width="109" height="30" /></a></li>
  </ul>
     <ul>
    <li><a href="bestellung_dessert.php" ><img src="../images/butdessert.png" alt="" onmouseover="this.src='../images/butdessert_hover.png';" onmouseout="this.src='../images/butdessert.png'" width="109" height="30" /></a></li>
  </ul>
   </div>
   <div id="notizen">
    <?
    /*
 karte.txt
 1;Pizza Margherita;pizza;13.00,25.00;(normal),(gross)
 2;Pizza Marinara;pizza;16.00,27.00;(normal),(gross)
 3;Pizza Funghi;pizza;16.00,27.00;(normal),(gross)
 4;Pizza Prosciutto;pizza;18.00,29.00;(normal),(gross)
 24;Pizza Calzone farcito;pizza;22.00;(normal)
 25;Pizza Bella Capri speziale;pizza;35.00;(normal)
 27;Frittura mista di pesce;spezialitäten;30.00;(gross)
 28;Verde;insalate;7.00;(normal)
 33;Griechischer Salat (min 300gr);insalate;14.00;(normal)
 34;Spaghetti alla Mafiosa;pasta;17.00;(normal)
 40;Lasagne;pasta;18.00;(normal)
 41;Tirami'su;dessert;8.00;(normal)
 45;Schlagrahm;dessert;1.00;(normal)
 46;Nature;getränke;4.00;(50cl)
 etc.    */
    $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;
         if((isset($_GET['pizza']) && $gruppe == $_GET['pizza']) || (!isset($_GET['pizza']) && $gruppe == $gruppe)){ #if($gruppe==$gruppe){ wenn alle gruppen angezeigt werden sollen
          # 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 '<input type="text" style="border:1px solid black; width:20px" maxlength="2" name="'.$id.'_notizen" value=""><br>';
          echo $outputradio;
          echo '&nbsp; <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"])){
      #############################
      # Warenkorb +/- verarbeitung
     if(isset($_GET["key"]) && isset($_GET["plus"])){
      $_SESSION["KORB"][$_GET["key"]]=($_SESSION["KORB"][$_GET["key"]]+1);
     }elseif(isset($_GET["key"]) && isset($_GET["minus"])){
        $_SESSION["KORB"][$_GET["key"]]=((float)$_SESSION["KORB"][$_GET["key"]]-1);
        if($_SESSION["KORB"][$_GET["key"]]<"1"){
         unset($_SESSION["KORB"][$_GET["key"]]);
        }
     }elseif(isset($_GET["key"]) && isset($_GET["raus"])){
        unset($_SESSION["KORB"][$_GET["key"]]);
     }
      # Warenkorb +/- verarbeitung
      #############################
    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 "
     <a style='text-decoration:none' href='?key=".$key."&amp;minus'>[-]</a>
     <a style='text-decoration:none' href='?key=".$key."&amp;plus'>[+]</a>
     <a style='text-decoration:none' href='?key=".$key."&amp;raus'>[x]</a>
     <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="Bestellung abschicken" /></form><br /></center>
  </div>
 </div>
 <div id="footer">
  &copy; 2010 Pizza da Mamma.  All rights reserved
 </div>
 <map name="Map" id="Map">
  <area shape="rect" coords="110,2,128,63" href="#" />
 </map>
 <map name="Map2" id="Map2">
  <area shape="rect" coords="109,1,126,65" href="#" />
 </map>
 <map name="Map3" id="Map3">
  <area shape="rect" coords="111,2,127,67" href="#" />
 </map>
 <map name="Map4" id="Map4">
  <area shape="rect" coords="112,0,128,64" href="#" />
 </map>
 <pre>
<?php
#rint_r($_GET);
#print_r($_SESSION);
?>
</pre>
</body>
</html>
Leider werden aber immer alle Sachen auf jeder Seite angezeigt, obwohl ich deinen Code eingegeben habe, kannst du mir helfen?

Zudem habe ich das Problem, dass ich nicht auf die Seiten Spezialitäten und Getränke komme, folgende Fehlermeldung:
Code:
[B]Warning[/B]: Unknown: failed to open stream: No such file or directory in [B]Unknown[/B] on line [B]0[/B]
 
[B]Fatal error[/B]: Unknown: Failed opening required 'C:/xampp/htdocs/Alex/php/bestellung_spezialitäten.php' (include_path='.;C:\xampp\php\PEAR') in [B]Unknown[/B] on line [B]0[/B]
Der hover geht auch bei diesen Knöpfen, aber eben es verlinkt nicht und dann kommt diese Fehlermeldung. Diese zwei Seiten, bestellung_getränke.php und bestellung_spezialitäten.php liegen im gleichen Ordner und sind genau so benennet so wie ich das jetzt geschrieben habe, wo liegt hier der Fehler?

Vielen Dank im Voraus

Freundliche Grüsse

PS: Hier ein Bild mit dem Menu, etc. WarenkorbmitMenu.jpg
 
Zudem habe ich das Problem, dass ich nicht auf die Seiten Spezialitäten und Getränke komme, folgende Fehlermeldung:

Umlaute in Dateinamen sind gern problematisch.
Nenn die mal
/bestellung_spezialitaeten.php

und include die auch so, dann sollte das schonmal gehn.
 
Werbung:
das noch nebenbei: dein doctype is bischen verdaddelt:
HTML:
<!DOCtypeE 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">
 
Hallo,

also soll ich dir eine auf die finger hauen, Zeile50 war nur zu kopieren inkl. den Links als Muster.

Das funzt so das nur auf seite bestellungen bleibst egal was bestellen möchtest ob pizza oder pasta. Man könnte zwar für jedes eine eigene seite machen aber wieso, so macht man sich bloss die spätere pflege unnötig schwer, gerade wenn mein kein CMS hat.
Zum Anfang wird alles angezeigt, man könnte natürlich pizza als haupt/default nehmen für den ersten besuch, BLÖD IS JETZT SO, nur pizza ist beim ersten besuch angezeigt, das wird in der alten Zeile50 jetzt 79 gemacht.

Links gehen so jetzt auch, da hat sich das von @vast geklärt was natürlich richtig ist, umlaute sind misst :O). wenn ich auf doctype achte dann nur noch html5, solltest auch mal überlegen, denn hast gleich ein valide seite anstelle error über error.

ps: kleiner eigener php fehler behoben zeile87

PHP:
<?php
error_reporting(-1); // -1 = alle Bits gesetzt, alle Fehler anzeigen
session_start();
?>
<!DOCtypeE 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-typee" content="text/html; charset=iso-8859-1" />
 <link rel="stylesheet" typee="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="bestellungmenu">
     <ul>
    <li><a href="?anzeige=pizza" ><img src="../images/butpizza_active.png" alt="" onmouseover="this.src='../images/butpizza_hover.png';" onmouseout="this.src='../images/butpizza_active.png'" width="109" height="30" /></a></li>
  </ul>
     <ul>
    <li><a href="?anzeige=pasta" ><img src="../images/butpasta.png" alt="" onmouseover="this.src='../images/butpasta_hover.png';" onmouseout="this.src='../images/butpasta.png'" width="109" height="30" /></a></li>
  </ul>
     <ul>
    <li><a href="?anzeige=spezialitäten" ><img src="../images/butspezialitäten.png" alt="" onmouseover="this.src='../images/butspezialitäten_hover.png';" onmouseout="this.src='../images/butspezialitäten.png'" width="109" height="30" /></a></li>
  </ul>
     <ul>
    <li><a href="?anzeige=getränke" ><img src="../images/butgetränke.png" alt="" onmouseover="this.src='../images/butgetränke_hover.png';" onmouseout="this.src='../images/butgetränke.png'" width="109" height="30" /></a></li>
  </ul>
     <ul>
    <li><a href="?anzeige=insalate" ><img src="../images/butinsalate.png" alt="" onmouseover="this.src='../images/butinsalate_hover.png';" onmouseout="this.src='../images/butinsalate.png'" width="109" height="30" /></a></li>
  </ul>
     <ul>
    <li><a href="?anzeige=dessert" ><img src="../images/butdessert.png" alt="" onmouseover="this.src='../images/butdessert_hover.png';" onmouseout="this.src='../images/butdessert.png'" width="109" height="30" /></a></li>
  </ul>
   </div>
   <div id="notizen">
    <?
    /*
 karte.txt
 1;Pizza Margherita;pizza;13.00,25.00;(normal),(gross)
 2;Pizza Marinara;pizza;16.00,27.00;(normal),(gross)
 3;Pizza Funghi;pizza;16.00,27.00;(normal),(gross)
 4;Pizza Prosciutto;pizza;18.00,29.00;(normal),(gross)
 24;Pizza Calzone farcito;pizza;22.00;(normal)
 25;Pizza Bella Capri speziale;pizza;35.00;(normal)
 27;Frittura mista di pesce;spezialitäten;30.00;(gross)
 28;Verde;insalate;7.00;(normal)
 33;Griechischer Salat (min 300gr);insalate;14.00;(normal)
 34;Spaghetti alla Mafiosa;pasta;17.00;(normal)
 40;Lasagne;pasta;18.00;(normal)
 41;Tirami'su;dessert;8.00;(normal)
 45;Schlagrahm;dessert;1.00;(normal)
 46;Nature;getränke;4.00;(50cl)
 etc.    */
    $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;
         if((isset($_GET['anzeige']) && $gruppe == $_GET['anzeige']) || (!isset($_GET['anzeige']) && $gruppe == "pizza")){ #if($gruppe==$gruppe){ wenn alle gruppen angezeigt werden sollen
          # 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."|".$einheit."'>".$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 '<input type="text" style="border:1px solid black; width:20px" maxlength="2" name="'.$id.'_notizen" value=""><br>';
          echo $outputradio;
          echo '&nbsp; <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"]); unset($_SESSION["KORB_preis"]);
  if(isset($_SESSION["KORB"])){
      #############################
      # Warenkorb +/- verarbeitung
     if(isset($_GET["key"]) && isset($_GET["plus"])){
      $_SESSION["KORB"][$_GET["key"]]=($_SESSION["KORB"][$_GET["key"]]+1);
     }elseif(isset($_GET["key"]) && isset($_GET["minus"])){
        $_SESSION["KORB"][$_GET["key"]]=((float)$_SESSION["KORB"][$_GET["key"]]-1);
        if($_SESSION["KORB"][$_GET["key"]]<"1"){
         unset($_SESSION["KORB"][$_GET["key"]]);
        }
     }elseif(isset($_GET["key"]) && isset($_GET["raus"])){
        unset($_SESSION["KORB"][$_GET["key"]]);
     }
      # Warenkorb +/- verarbeitung
      #############################
    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 "
     <a style='text-decoration:none' href='?key=".$key."&amp;minus'>[-]</a>
     <a style='text-decoration:none' href='?key=".$key."&amp;plus'>[+]</a>
     <a style='text-decoration:none' href='?key=".$key."&amp;raus'>[x]</a>
     <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="Bestellung abschicken" /></form><br /></center>
  </div>
 </div>
 <div id="footer">
  &copy; 2010 Pizza da Mamma.  All rights reserved
 </div>
 <map name="Map" id="Map">
  <area shape="rect" coords="110,2,128,63" href="#" />
 </map>
 <map name="Map2" id="Map2">
  <area shape="rect" coords="109,1,126,65" href="#" />
 </map>
 <map name="Map3" id="Map3">
  <area shape="rect" coords="111,2,127,67" href="#" />
 </map>
 <map name="Map4" id="Map4">
  <area shape="rect" coords="112,0,128,64" href="#" />
 </map>
 <pre>
<?php
#rint_r($_GET);
#print_r($_SESSION);
?>
</pre>
</body>
</html>
Cheffchen
 
Hallo zusammen

@vest Danke für deine Hilfe und somit
@Cheffchen danke dass du den Fehler den er gefunden hat, gerade behoben hast. Und nein, auf die Finger musst du mir nicht hauen, habe das einfach anderst aufgefasst als du dachtest, trotzdem vielen Dank!

Ich versuche jetzt wenn z.B. "?anzeige=spezialitäten", dass dann das Bild butspezialitäten_active kommt, dass dieser "link" als der aktive gekennzeichnet wird, wie bis jetzt bei meinem richtigen Navi/Menu. btw das mit dem Mail versuche ich auch noch zu lösen, werde euch voraussichtlich heute Abend mal was posten :-) Danke

Freundliche Grüsse
 
Werbung:
Hallo Cheffchen

Leider ist es jetzt schon später als ich gesagt habe, aber ich wollte noch länger ausprobieren. Ich schaffe es aber leider nicht. Ich wollte ja wie bei dem normalen Menu machen, dass das untere Menu für die einzelnen Auswahlen auch die Bilder mit rot (active) kommen. Aber das geht nicht, weil ja jetzt über z.B. ?anzeige=pizza ist und wie bringe ich jetzt den active link rein? Könntest du mir bitte helfen?

Vielen Dank :-)

Freundliche Grüsse
 
Werbung:
Hey Cheffchen

Vielen Dank und ich habe das gerade für die anderen übernommen.
PHP:
<?php
 $pizzaa="";
 $pastaa="";
 $spezialitätena="";
 $getränkea="";
 $insalatea="";
 $desserta="";
 if(isset($_GET['anzeige'])){
    if($_GET['anzeige'] =="pizza"){$pizzaa="_active";}
    if($_GET['anzeige'] =="pasta"){$pastaa="_active";}
    if($_GET['anzeige'] =="spezialitäten"){$spezialitätena="_active";}
    if($_GET['anzeige'] =="getränke"){$getränkea="_active";}
    if($_GET['anzeige'] =="insalate"){$insalatea="_active";}
    if($_GET['anzeige'] =="dessert"){$desserta="_active";}
 }else{
 $pizzaa="_active";
 }
 ?>
     <ul>
    <li><a href="?anzeige=pizza" ><img src="../images/butpizza<?php echo $pizzaa;?>.png" alt="" onmouseover="this.src='../images/butpizza_hover.png';" onmouseout="this.src='../images/butpizza<?php echo $pizzaa;?>.png'" width="109" height="30" /></a></li>
  </ul>
     <ul>
    <li><a href="?anzeige=pasta" ><img src="../images/butpasta<?php echo $pastaa;?>.png" alt="" onmouseover="this.src='../images/butpasta_hover.png';" onmouseout="this.src='../images/butpasta<?php echo $pastaa;?>.png'" width="109" height="30" /></a></li>
  </ul>
     <ul>
    <li><a href="?anzeige=spezialitäten" ><img src="../images/butspezialitäten<?php echo $spezialitätena;?>.png" alt="" onmouseover="this.src='../images/butspezialitäten_hover.png';" onmouseout="this.src='../images/butspezialitäten<?php echo $spezialitätena;?>.png'" width="109" height="30" /></a></li>
  </ul>
     <ul>
    <li><a href="?anzeige=getränke" ><img src="../images/butgetränke<?php echo $getränkea;?>.png" alt="" onmouseover="this.src='../images/butgetränke_hover.png';" onmouseout="this.src='../images/butgetränke<?php echo $getränkea;?>.png'" width="109" height="30" /></a></li>
  </ul>
     <ul>
    <li><a href="?anzeige=insalate" ><img src="../images/butinsalate<?php echo $insalatea;?>.png" alt="" onmouseover="this.src='../images/butinsalate_hover.png';" onmouseout="this.src='../images/butinsalate<?php echo $insalatea;?>.png'" width="109" height="30" /></a></li>
  </ul>
     <ul>
    <li><a href="?anzeige=dessert" ><img src="../images/butdessert<?php echo $desserta;?>.png" alt="" onmouseover="this.src='../images/butdessert_hover.png';" onmouseout="this.src='../images/butdessert<?php echo $desserta;?>.png'" width="109" height="30" /></a></li>
  </ul>
funktioniert super! :-)

Und jetzt zum Mail hätte hier auch schon einen Vorschlag parat:
<?php
$empfaenger = "Feld dass man auf der Seite ausfüllen kann, unter dem Warenkorb";
$absendername = "Pizza da Mamma";
$absendermail = "[email protected]";
$betreff = "Bestellung bei Pizza da Mamma";
$text = "Lieber Kunde, die folgende Bestellung haben sie so eben getätigt:
Dann hier die Sachen wo im Korb stehen, Name, Preis, Total. Schön wäre es natürlich auch, wenn hier noch die Wohnangaben mit Telfonnummer des Kuden stehen würde, die ich auch unter dem Warenkorb mit einem Feld eingeben könnte, wie beim $empfaenger.";
mail($empfaenger, $betreff, $text, "From: $absendername <$absendermail>");
?>
Kannst du mir vielleicht helfen? Und wie schickt es dann das Formular ab - Knopf?

Vielen Dank im Voraus

Freundliche Grüsse
 
Hey Cheffchen

Ich wollte jetzt einfach einmal die einzelnen Sachen festlegen, was sie sind, aber leider geht das nicht, weiss du vil. was falsch ist?
PHP:
  <div id="Formularfelder">
   <?php
   $empfaenger='
   <form action="input_text.htm"><p>Email:<br><input name="empfaenger" type="text" size="30" maxlength="30"></p></form>';
   ?>
  </div>
Würde mich über deine Hilfe freuen

Freundliche Grüsse
 
Zurück
Oben