topical media & game development
basic-ajax-08-cartdisplay.php / php
<?php
session_register('Cart');
header('Content-Type: text/xml');
?>
<?php
_POST["book"];
_POST["action"];
if (MDA = action == "Add")
{
if (newitem] != "")
{
MDA[MDA[value;
MDA;
ECHO (toXml(MDA[_SESSION["Cart"] = MDA));
}
}
else
{
MDA[newitem];
_SESSION["Cart"] = "";
ECHO (toXml(MDA[_SESSION["Cart"] = MDA));
}
function toXml(doc = new DomDocument('1.0');
doc->appendChild(total = 0;
foreach (Item => book = doc->createElement('book'));
doc->appendChild(title->appendChild(Item));
book->appendChild(authors->appendChild(_POST['authors']));
book->appendChild(isbn->appendChild(_POST['ISBN']));
","",priceNode = doc->createElement('Price'));
doc->createTextNode(quantity = doc->createElement('Quantity'));
doc->createTextNode(book->appendChild(book->appendChild(book->appendChild(book->appendChild(book->appendChild(total = ItemName;
}
cart->appendChild(totalNode->appendChild(total));
doc->saveXML();
return
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.