Home | Registrieren | Einloggen | Suchen | Aktuelles


Forum » PHP & MySQL » Sessions Antworten
Sessions

corny
Mausakrobat


Beiträge: 206


Ich habe ein Kleien Wahrenkorbsysthem eingerichtet und finde den Fehler nicht.
Das ist der Link:
http://www.beatmaschine.de/corny/catalog.php
Wenn man auf Wahrenkob ansehen Klickt ist nichts im Wahrekorb enthalten, wieso nicht?


cartalog.php:
1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
25: 
26: 
27: 
28: 
29: 
30: 
31: 
32: 
33: 
34: 
35: 
36: 
37: 
38: 
39: 
40: 
41: 
42:
<?php
 $shoppingcart = array();
 session_start();
 session_register('shoppingcart');
 if ($buy != "") {
  $shoppingcart[] = $buy;
  header("Location: $PHP_SELF?".SID);
  exit();
 }
?>

<html>
<head>
 <title>Produktkatalog</title>
</head>
<body bgcolor="#FFFFFF" text ="#000000">
 <p>Ihr Warenkorb enth&auml;lt <?=count($shoppingcart)?> Artikel.</p>
 <p><a href="cart.php">Warenkorb ansehen</a></p>
<?php
 $items = array( "Kanadisch-australisches Lexikon",
    "Benutzter Fallschirm (unge&ouml;ffnet)",
	"Goldfischgesang (2 CDs)",
	"Mit PHP4 aufh&ouml;ren (O'Wroxley)");
 $Prices = array( 24.95, 1000, 19.99, 34.95 );
?>
   <table border="1">
    <tr>
      <th>Artikelbeschreibung</th>
      <th>Preis</th>
    </tr>
   <?php
    for($i = 0; $i < count($items); $i++) {
	   echo("<tr>");
	   echo("<td>".$items[$i]."</td>");
	   echo("<td>$".number_format($Prices[$i],2)."</tr>");
	   echo("<td><a href='$PHP_SELF?buy=$i'>Kaufen</a></td>");
	   echo("</tr>");
   }
  ?>
  </table>
  </body>
  </html>



cart.php:
1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
25: 
26: 
27: 
28: 
29: 
30: 
31: 
32: 
33: 
34: 
35: 
36: 
37: 
38: 
39: 
40: 
41: 
42: 
43: 
44: 
45: 
46: 
47: 
48: 
49: 
50:
<?php
  $shoppingcart = array();
  session_start();
  session_register('shoppingcart');
  if ($empty != "") {
    session_unregister("shoppingcart");
	header("Location: $PHP_SELF?".SID);
	exit();
  }
?>
<html>
<head>
  <title>Warenkorb</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
 <h1>Ihr Wahrenkorb</h1>
<?php
 $items = array( "Kanadisch-australisches Lexikon",
    "Benutzter Fallschirm (unge&ouml;ffnet)",
	"Goldfischgesang (2 CDs)",
	"Mit PHP4 aufh&ouml;ren (O'Wroxley)");
 $Prices = array( 24.95, 1000, 19.99, 34.95 );
?>
   <table border="1">
    <tr>
      <th>Artikelbeschreibung</th>
      <th>Preis</th>
    </tr>
   <?php
    for($i = 0; $i < count($shopppingcart); $i++) {
	   echo("<tr>");
	   echo("<td>".$items[$shoppingcart[$i]]."</td>");
	   echo("<td align=\"right\">$");
	   echo(number_format($Prices[$shoppingcart[$i]],2));
	   echo("</td>");
	   echo("</tr>");
	   $total = $total + $Prices[$shoppingcart[$i]];
   }
  ?>
   <tr>
      <th align="right">Gesamtpreis</th><br>
      <th align="right">$<?=number_format($total,2)?></th>
   </tr>
  </table>
  <p><a href="catalog.php">Zur&uuml;ck zum Katalog</a> oder
  <a href="<?=$PHP_SELF?>?empty=1">Wahrenkorb l&ouml;schen</a></p>
</body>
</html>
      


Das sind die Quellterxte, nun finde ich aber den Fehler nicht, kann mir da jemand helfen?

thx Corny


---
www.webworxis.de

  Profil   E-Mail   Website   Editieren   Zitieren

alexhaid
Fachidiot


Beiträge: 132


Hallo Corny!

Ich habe den Fehler jetzt auf die Schnelle auch nicht gefunden. Aber ich denke, dass du ein Problem mit der Übergabe der SessionID hast...?
Aber ließ doch http://www.php.net/manual/de/ref.session.php genau durch. Da solltest du was finden.
Wahrenkorb ohne h!!!!!!!

alex


  Profil   E-Mail   Editieren   Zitieren

corny
Mausakrobat


Beiträge: 206


Oh, ok mein "Wahrekorb" funzt leider auf dem Server net, wieso auch immer, sie haben mir gesagt sie wollen das nicht, irgendwie komisch aber sonst schon ok.
Corny

---
www.webworxis.de

  Profil   E-Mail   Website   Editieren   Zitieren
 

Antworten
Nach oben