Php batch modification problems

Source: Internet
Author: User
Php batch modification problem table & nbsp; user & nbsp; user_id & nbsp; money & nbsp; 1 & nbsp; & nbsp; 1000 & nbsp; 2 & nbsp; php batch modification problems
Table user
User_id money
1 1000
2 1500
3 1200
4 1300

How to modify the money field in batches?
Front-end code:




Q: How to deal with the $ _ POST ['user'] and $ _ POST ['jf'] Arrays and ensure that the two values correspond one to one?
How to write specific code? Thank you!
------ Solution --------------------
Unselected checkbox is not submitted
Checkbox submits values (arrays)

According to your design
$ _ POST ['jf'] [$ _ POST ['user'] [I]-1] is the jf
I is the subscript of the passed $ _ POST ['user'] array.

This is usually recommended


Make one-to-one correspondence at the beginning
------ Solution --------------------






$jf = $_POST['jf'];
$user = $_POST['user'];
foreach($user as $v){
echo $jf[$v];
}

------ Solution --------------------


Hour
foreach($_POST['user'] as $k) {
  printf('%s %s', $k, $_POST['jf'][$k-1]);
}



Hour
foreach($_POST['user'] as $k) {
  printf('%s %s', $k, $_POST['jf'][$k]);
}

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.