change quantity button cannot be functioned, PHP Web Programming

Assignment Help:
error_reporting(0);
session_start();
header(''Content-type: text/html; charset=utf-8'');
include_once(''../../xajax_core/xajax.inc.php''); // ?? xajax
$xajax = new xajax(); // ?? xajax ??

// ??????
$chaObj=$xajax->registerFunction(''change_quantity'');
$chaObj->useSingleQuote();
$chaObj->addParameter(XAJAX_FORM_VALUES,''form1'');
$xajax->processRequest(); // ????

$xajax->printJavascript();


//---------------------- ????? ---------------------
// ?????????????

function change_quantity($form) {

$objResponse = new xajaxResponse(); // ??????
// ???? Checkbox ??? p_id, ????, ??????
// ?????????? ''p_id'' ??, ??????????
// ????????

if(isset($form[''p_id''])) {
// ?????????????
foreach($form[''p_id''] as $p_id) {
// ???????????????
if($form[''qua''][$p_id]==''0'') {
// ???????? 0, ????????????
unset($_SESSION[''cart''][$p_id]);

if(count($_SESSION[''cart''])==0) { // ????????
$objResponse-> // ?????
script(''alert("cart has no items");window.close();'');
unset($_SESSION[''cart'']);
}
else { // ???????????
// ?????????????
$objResponse->remove($p_id);

// ???????????
$objResponse->assign(''total'',''innerHTML'',gettotal());
}
}
else if ($form[''qua''][$p_id]>0) {
// ????? 0 ??, ?????????????
$_SESSION[''cart''][$p_id][''quantity''] = $form[''qua''][$p_id];

// ??????, ?????????????????
$objResponse->assign(''sub['' . $p_id . '']'', ''innerHTML'',
$_SESSION[''cart''][$p_id][''quantity''] *
$_SESSION[''cart''][$p_id][''price'']);
$objResponse->assign(''total'',''innerHTML'',gettotal());
}
else {
// ??????, ?????????
$objResponse->assign(''qua['' . $pid . '']'', ''innerHTML'',
$_SESSION[$pid][''quantity'']);
}
}
}
return $objResponse; // ??????
} // ???? change_quantity() ??

// ????????
function getTotal() {
$total = 0;
foreach($_SESSION[''cart''] as $p_id => $item)
$total += ($item[''quantity''] * $item[''price'']);

return $total;
}


//---------------------- ??? HTML ---------------------
// ?????????, ?????????????????
if( !isset($_SESSION[''cart'']) ) { // ???????
echo "";
exit();
}
?>
?????




printJavaScript(''/''); ?>





cellspacing="0" cellpadding="2"
style="text-align:center;border:1px solid silver">













// ?????????
$total = 0;
foreach($_SESSION[''cart''] as $p_id => $item) {
// ???? id ???? $p_id, ???????
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "";
echo "\n";
echo "\n";
}
?>




cart
all

onClick="select_all(''form1'',''p_id[]'',this.name);">
product name unit price quantity subtotal
" .
" $p_id . "''>
" . $item[''name''] . "" . $item[''price''] . "×" .
" value=''" . $item[''quantity''] . "'' size=''3''>
=" .""."
total:













onClick="settozero(''form1'',''p_id[]'')">

onClick="xajax_change_quantity(xajax.getFormValues(''form1''))">

onClick="window.close();">

onClick="location.href=''checkout.php'';">



Related Discussions:- change quantity button cannot be functioned

I need creative web page developer, I need Creative Web Page Developer P...

I need Creative Web Page Developer Project Description: I'm seeking a creative and skilled developer to assist in developing our web pages. Our pages aim a certain marked wit

Create the website home page, For storing pages now that a site structure i...

For storing pages now that a site structure is set up & assets for the Compass site, you'll develop the first page-a home page for the site. As you develop this page, you'll insert

Web and mobile interface for the workforce, Web and Mobile Interface for th...

Web and Mobile Interface for the Workforce MyEma is an innovative online interface paired with a slick as well as easy to use application. The key objectives of this project are

Help in google feeds not working in magento site, Help in Google Feeds not ...

Help in Google Feeds not working in Magento Site We are in want of superb magento developer. We have some clients sites that are all made in different platforms like wordpress,m

Implement wordpress design in my existing site, Implement wordpress design ...

Implement wordpress design in my existing site Project Description: Hello i want a design for my current website. This WordPress design require implement Skills requ

Business starter website needs to grow up a little need help, My business' ...

My business' starter website needs to grow up a little The site was completely homemade when I started my business last year. While it's visually striking, the way it was constr

Advanced html, In the previous unit you have study the fundamentals of HTML...

In the previous unit you have study the fundamentals of HTML. After study about how to make static web pages, now let us study how to develop Interactive Web sites. A good web site

We need a fast- top-notch- ruby and rails developer, We need a Fast, Top-No...

We need a Fast, Top-Notch, Ruby (and Rails) Developer We're seeking a backup Rails developer for our creative team. We by now have a Senior Developer/Analyst and a part-time PHP

Need multi-language website of a retirement resort project, Multi-language ...

Multi-language website of a retirement resort project. I am seeking a website developer for a retirement resort project with the end in view of marketing the resort to worldwide

Serbian php developer wanted for long terms, Serbian PHP Developer wanted >...

Serbian PHP Developer wanted > Must be creative with UI Experience, etc We are interested for a RESPONSIBLE as well as well-organized programmer with the following requirements

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd