PHPpost array problems

Source: Internet
Author: User
My page is written as follows:
Here, select is only one of them. I have about 20 select controls.
                              {#section name=one loop=11 start=10 step=-1#}                                    {#$smarty.section.one.index#}                   {#/section#}                      


Now I need to save the submitted information in the background:
If (is_array ($ _ POST ['zb']) & count ($ _ POST ['zb'])> 0) {for ($ I = 0; $ I
   
  
The strange thing is that I have 10 select controls, but only 4 controls are valid when submitted to the backend. The remaining six are all null values. what is going on?


Reply to discussion (solution)

Print_r ($ _ POST ['zb']);
Post result

Paste the HTML code to see the value of print_r ($ _ POST.

if (!empty($_POST['zb'][$i]))

Your judgment is incorrect.
If the control value is not 0, Null, or Null


If the value is 0, it will not be executed.


This is the result. there are values in the first few, and there will be no values in the latter.

Check whether the select option has a value.

Thank you very much for writing the error at the front desk.

                              {#section name=one loop=11 start=10 step=-1#}                                    {#$smarty.section.one.index#}                   {#/section#}                      

The value here is a null 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.