CI multi-form traffic extraction-php Tutorial

Source: Internet
Author: User
CI uses multiple forms to raise traffic, but Masters can help you see what went wrong.
If (! Empty ($ _ POST ['num']) |
! Empty ($ _ POST ['title']) |
! Empty ($ _ POST ['price']) |
! Empty ($ _ POST ['ears']) |
! Empty ($ _ POST ['Season ']) |
! Empty ($ _ POST ['groupup'])
{

$ W = array (
Foreach ($ _ POST as $ k => $ v ):
If (! Empty ($ v )){
$ K => $ v;
}
Endforeach;
)
}
Just fail


Reply to discussion (solution)

What is the writing method? foreach in the array? Can this work?

This method is unknown.

I just want to do a multi-form search,
It is to restrict multiple search conditions at the same time. each condition is in the form of a single form,
There is a single-line text box or a drop-down menu, you can not limit all the conditions at the same time,
I don't know how to do this.

Why are multiple forms and multiple search conditions in one form not supported ???

Does not it filter out invalid (null) input items?

$w = array_diff($_POST, array('', 0));

You can.

Xuzuning!
You are my God, and worship the places you worship

If (! Empty ($ _ POST ['num']) |
! Empty ($ _ POST ['names']) |
! Empty ($ _ POST ['price']) |
! Empty ($ _ POST ['ears']) |
! Empty ($ _ POST ['Season ']) |
! Empty ($ _ POST ['groupup']) |
! Empty ($ _ POST ['note'])
{



$ W = array_diff ($ _ POST, array ('', 0 ));}

// Paging parameters, route coordination
$ Config ['base _ url'] = 'http: // localhost/ci/index. php/product/search ';
$ Num = $ this-> product_model-> search_page ($ w); // $ w is not defined during the call.
$ 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 );
} // The paging parameter ends.

$ Data ['title'] = 'item Center ';
// $ _ Where = array ('type' => 'newstore ');
$ Data ['data'] = $ this-> product_model-> search_paging ($ w, $ config ['per _ page'], $ offset ); // $ w is not defined here.

$ W = array (); if ($ _ POST) {$ w = array_diff ($ _ POST, array ('', 0);} // paging parameter, route coordination .....

Master master

Thanks to xuzuning for helping our birds

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.