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

Radio button, Radio buttons are used while only one out of the group of cho...

Radio buttons are used while only one out of the group of choice is to be selected. In the example code we have put a line break after every button. Each of the Radio Buttons ha

We need a analyst python programmer, We need a Analyst Programmer Our Es...

We need a Analyst Programmer Our Esteemed as well as Reputable Client is looking for an Analyst Programmer (Python) for their organization. The candidate is mandatory to perform

We need joomla-php-mysql developer, We Need Joomla-PHP-MySQL Developer W...

We Need Joomla-PHP-MySQL Developer We need a developer who can work on our website built on Joomla to focus. Candidate must be very strong in Joomla, PHP, MySQL Development.

Create a date instance, The Date object is utilized to work with dates & ti...

The Date object is utilized to work with dates & times. Creating a Date Instance You must create an instance of the Date object along with the "new" keyword. The following

Need php to help to develop msds project tracking system, Need to help to d...

Need to help to develop MSDS Project Tracking System using PHP Object Oriented PHP, MySQL, jQuery, jQuery UI, Job Description- Your responsibilities 1) Review business req

In search of high quality php work, In search of High Quality Work I am ...

In search of High Quality Work I am in search of both web application and mobile application talent. If you do one as well as not the other that's perfectly fine. I am looking f

Design and implement a frame-based personal web page, Design and implement ...

Design and implement a frame-based personal Web page. Include everything that you would like to share with your friends. This must include but not limited to: A short biogra

Need help in wordpress website migration and move, Wordpress website migrat...

Wordpress website migration / move We have a word press site that is not working with the duplicator plugin. We just want it shifting across to some new hosting. Must just

We need messaging system for buyers as well as sellers, We need Messaging s...

We need Messaging system for buyers as well as sellers Need a messaging system to be implemented as a module into shopping cart system. It would be great if to inactivate the me

Group cells in a layout table, Now you will insert the navigation button ce...

Now you will insert the navigation button cells you just created in a single table. Grouping the cells into a table makes able you to control the cell spacing and to simply move th

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