Home > Backend Development > PHP Tutorial > PHP updates shopping cart quantity (form part/PHP processing part)_PHP tutorial

PHP updates shopping cart quantity (form part/PHP processing part)_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-21 15:10:35
Original
796 people have browsed it

Form part:

Copy code The code is as follows:






PHP processing part:
Copy code The code is as follows:

require 'config.inc.php';
require 'checklogin.php';
$username = $ _SESSION['username'];
$action = $_GET['action'];
switch ($action) {
case "edit_num":

$arr = $arr = $_POST['suliang'];
foreach($arr as $key=>$value){
$sqlgx = "update `cartemp` set suliang='$value' where username='".$ username."' and flag=0 and sp_id='".$key."'";
mysql_query($sqlgx, $conn);
echo "<script>location.href='shopcat.php '</script>";
}
break;

case "null":
$null_sql = "delete from `cartemp` where username='$username' and flag= 0 ";
mysql_query($null_sql, $conn);
echo "<script>location.href='shopcat.php'</script>";
break;
case " del":
$id = $_GET['id'];
$del_sql = "delete from `cartemp` where id=$id";
mysql_query($del_sql, $conn);
echo "<script>location.href='shopcat.php'</script>";
break;
}
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327053.htmlTechArticleForm part: Copy the code as follows: form action="?action=edit_num" method="post" name= "car?php $c_rs['id'];?" id="car?php $c_rs['id'];?" input name="suliang[?php echo $c_rs...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template