Ja, he he
Jeg ville meget gerne have hjælp til denne kode også:
<form action="
https://www.paypal.com/cgi-bin/webscr" method="post">
<div align="center">
<input type="hidden" name="cmd" value="_cart"/>
<input type="hidden" name="upload" value="1"/>
<input type="hidden" name="business" value="carina2b@hotmail.com"/>
<input type="hidden" name="item_name_1" value="<?php echo getTotalContents(); ?>"/>
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="amount_1" value="<?php echo getTotalPrice(); ?>"/>
<input type="image" src="
http://www.paypal.com/en_US/i/btn/x-click-but01.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</div>
</form>
Det er der hvor kunden trykker sig videre til paypal, jeg vil også komme ind på det til eksamen...
Hvad sker der præcist der?
Hele sidens kode er her:
<?php
// Include MySQL class
require_once('inc/mysql.class.php');
// Include database connection
require_once('inc/global.inc.php');
// Include functions
require_once('inc/functions.inc.php');
// Start the session
session_start();
// Process actions
$cart = $_SESSION['cart'];
$action = $_GET['action'];
switch ($action) {
case 'add':
if ($cart) {
$cart .= ','.$_GET['id'];
} else {
$cart = $_GET['id'];
}
break;
case 'delete':
if ($cart) {
$items = explode(',',$cart);
$newcart = '';
foreach ($items as $item) {
if ($_GET['id'] != $item) {
if ($newcart != '') {
$newcart .= ','.$item;
} else {
$newcart = $item;
}
}
}
$cart = $newcart;
}
break;
case 'update':
if ($cart) {
$newcart = '';
foreach ($_POST as $key=>$value) {
if (stristr($key,'qty')) {
$id = str_replace('qty','',$key);
$items = ($newcart != '') ? explode(',',$newcart) : explode(',',$cart);
$newcart = '';
foreach ($items as $item) {
if ($id != $item) {
if ($newcart != '') {
$newcart .= ','.$item;
} else {
$newcart = $item;
}
}
}
for ($i=1;$i<=$value;$i++) {
if ($newcart != '') {
$newcart .= ','.$id;
} else {
$newcart = $id;
}
}
}
}
}
$cart = $newcart;
break;
}
$_SESSION['cart'] = $cart;
?>
<!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>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Organic Cotton, et multimediedesign eksamensprojekt</title>
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="MSSmartTagsPreventParsing" content="true" />
<meta name="description" content="Køb Vero modas nye økologiske kollektion her!" />
<meta name="keywords" content="Vero Moda, Organic Cotton" />
<meta name="author" content="Organic Girls" />
<style type="text/css" media="all">
@import "../organic.css";
</style>
</head>
<body>
<div id="content">
<div id="banner"><object type="application/x-shockwave-flash" data="../images/lonesBanner4.swf" width="900" height="200">
<param name="movie" value="../images/lonesBanner4.swf" />
<param name="quality" value="high" />
</object></div>
<div id="maincontent">
<div id="vdividermenu">
<ul>
<li><a href="../index.php" title="Home">Forside</a></li>
<li><a href="index.php" title="webshop">Webshop</a></li>
<li><a href="../visioner.php" title="visioner">Visioner</a></li>
<li id="current"><a href="../holdninger.php" title="Grundholdninger">Grundholdninger</a></li>
<li><a href="../betingelser.php" title="Handelsbetingelser">Handelsbetingelser</a></li>
<li><a href="../kontakt.php" title="kontakt">Kontakt </a></li>
</ul>
</div>
<div id="CartIndhold">
<?php
function getTotalPrice() {
global $db;
$cart = $_SESSION['cart'];
if ($cart) {
$items = explode(',',$cart);
$contents = array();
foreach ($items as $item) {
$contents[$item] = (isset($contents[$item])) ? $contents[$item] + 1 : 1;
}
foreach ($contents as $id=>$qty) {
$sql = 'SELECT * FROM books WHERE id = '.$id;
$result = $db->query($sql);
$row = $result->fetch();
extract($row);
$total += $price * $qty;
}
}
return $total;
}
?>
<?php
function getTotalContents() {
global $db;
$cart = $_SESSION['cart'];
if ($cart) {
$items = explode(',',$cart);
$contents = array();
foreach ($items as $item) {
$contents[$item] = (isset($contents[$item])) ? $contents[$item] + 1 : 1;
}
}
return $cart;
}
?>
<h1>Din kurv:</h1>
<?php
echo writeShoppingCart();
?>
<?php
echo showCart();
?>
<br/>
<form>
<input type="button" class="red" onclick="window.location.href='index.php'" value="Gå tilbage og shop videre"/>
</form>
<p>Klik på Paypal knappen når du er klar til at gennemføre dit køb. Du vil blive taget til Paypals side for at indtaste betalingsoplysninger. </p>
<p>Tak fordi du handler hos Vero Moda!</p>
<form action="
https://www.paypal.com/cgi-bin/webscr" method="post">
<div align="center">
<input type="hidden" name="cmd" value="_cart"/>
<input type="hidden" name="upload" value="1"/>
<input type="hidden" name="business" value="carina2b@hotmail.com"/>
<input type="hidden" name="item_name_1" value="<?php echo getTotalContents(); ?>"/>
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="amount_1" value="<?php echo getTotalPrice(); ?>"/>
<input type="image" src="
http://www.paypal.com/en_US/i/btn/x-click-but01.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</div>
</form>
</div>
</div>
</div>
<center><div id="footer2">
<p>©2008 | Vero Moda </p>
</div>
</center>
</body>
</html>
Jeg vil godt give nogen flere point....
:)