When the post field is many, the post field is not completely modified (some value is the value of the front-end input, some keep the original database value),

Source: Internet
Author: User

There is a workaround (Ps:from LJQ): The values of the database are all traversed first, and then the $key to iterate out the value of a judgment,

Example

foreach ($results [0] as $key = + $val) {

$results [0][$key] = isset ($_post[$key]) &&!empty ($_post[$key])? $_post[$key]: $val;
}

You can also make a new array of fields that are too post. And then some data processing,

Alternatively, the name value in input is made to rule, forming an array form

When the post field is many, the post field is not completely modified (some value is the value of the front-end input, some keep the original database value),

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.