PHP: update the number of shopping carts (Form part/PHP processing part) _ PHP Tutorial

Source: Internet
Author: User
PHP updates the number of shopping carts (PHP processing in the form part ). Form part: the Copy code is as follows: formaction? Actionedit_nummethodpostnamecar? Php $ c_rs [id];? Id];? Inputnamesuliang [? Phpecho $ c_rs Form part:

The code is as follows:




PHP processing:

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;
}
?>

Authorization: the code is 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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.