CI multiple Form submission pass but

Source: Internet
Author: User
The Masters are helping to see what's wrong with this section.
if (!empty ($_post[' num ')) | |
!empty ($_post[' title ') | |
!empty ($_post[' price ') | |
!empty ($_post[' years ') | |
!empty ($_post[' season ') | |
!empty ($_post[' groups ')
{

$w = Array (
foreach ($_post as $k = $v):
if (!empty ($v)) {
$k = $v;
}
Endforeach;
)
}
It's just a pass.


Reply to discussion (solution)

What is this notation, the array inside of foreach? Can you do that?

It's unheard of.

I just want to do a multi-form search,
is to limit multiple conditions to the search, each with a form,
There is a single-line text box, there are drop-down menus, you can not restrict all conditions at the same time,
I don't know how to do this.

Why do you want more forms, a form, multiple search conditions do not???

is not to filter out invalid (null) incoming items?

$w = Array_diff ($_post, Array (', 0));

You can do it.

Xuzuning!
You are my great God, worship the pleasantly surprised you adore.

if (!empty ($_post[' num ')) | |
!empty ($_post[' names ') | |
!empty ($_post[' price ') | |
!empty ($_post[' years ') | |
!empty ($_post[' season ') | |
!empty ($_post[' groups ') | |
!empty ($_post[' note '))
{



$w = Array_diff ($_post, Array (', 0));}

//paging parameter, routing mate
$config [' base_url '] = ' http://localhost/ci/index.php/product/search ';
$num = $this->product_model->search_page ($w),//$w not defined here
$config [' total_rows '] = $num;
$config [' per_page '] = 80;
$config [' uri_segment '] = ' 3 ';
$this->pagination->initialize ($config);

$pageNum = $this->uri->segment (3,1);
if ($pageNum ==1) {
$offset = 0;
}else{
$offset = $config [' Per_page ']* ($pageNum-1);
}//Paging parameter end

$data [' title '] = ' commodity center ';
//$_where = Array (' type ' = ' newstore ');
$data [' data '] = $this->product_model->search_paging ($w, $config [' Per_page '], $offset);//It says $w undefined

$w = Array (), if ($_post) {  $w = Array_diff ($_post, Array (', 0));} Paging parameters, routing mates .....

Master Master High Master

Thanks to xuzuning for helping us birds.

  • Related Article

    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.