html-php How to receive the option value under the Select tab

Source: Internet
Author: User

How PHP cannot receive the option value under the Select tab


  
        
  
        test 
//request.php
  
    $_POST,    'tuesday' => $_POST,    'wednesday' => $_POST,    'thursday' => $_POST,    'friday' => $_POST,    'saturday' => $_POST,    'sunday' => $_POST);// html是这样的![clipboard.png](/img/bVDKLV)

Var_dump ($_get);
The value is not received here

But the URL address bar is a value

Because I have nested PHP syntax inside HTML, but I can receive the value without using this foreach?

I want the effect is this, but not receive the value Oh?

That's what I want to end up with.
$arr = Array (

'monday' => $_POST,'tuesday' => $_POST,'wednesday' => $_POST,'thursday' => $_POST,'friday' => $_POST,'saturday' => $_POST,'sunday' => $_POST

);

The HTML is like this

Reply content:

How PHP cannot receive the option value under the Select tab


  
        
  
        test 
//request.php
  
    $_POST,    'tuesday' => $_POST,    'wednesday' => $_POST,    'thursday' => $_POST,    'friday' => $_POST,    'saturday' => $_POST,    'sunday' => $_POST);// html是这样的![clipboard.png](/img/bVDKLV)

Var_dump ($_get);
The value is not received here

But the URL address bar is a value

Because I have nested PHP syntax inside HTML, but I can receive the value without using this foreach?

I want the effect is this, but not receive the value Oh?

That's what I want to end up with.
$arr = Array (

'monday' => $_POST,'tuesday' => $_POST,'wednesday' => $_POST,'thursday' => $_POST,'friday' => $_POST,'saturday' => $_POST,'sunday' => $_POST

);

The HTML is like this

Select Do not write self-closing

Thank you for your invitation.
Follow the restful words, pass the data or use the Post form

Then you need to get it, use $_post[' key ' to get it.

If you do not get the value, it is recommended that you first use the JS console to see if your key is correct and avoid duplication.

Your $_get is empty, I have not guessed correctly, is the key value duplicates. Why is it?


You see, foreach is going through to the end, and the last you get is definitely empty.

So, the conclusion is:

检查一下你的key值,避免重复。

So obvious error, when you use foreach the HTML page similar to kemu1 the total number of name 7 , when you submit, the backend php received value will actually be the HTML last name selection box in the page value, So the current backend will receive only 7 of the value of the week . bugThere are two ways to change this, as follows

    • selectthe name values are changed into arrays, such as kemu1kemu1[]

    • foreachThe value of the loop is $row also placed select name , such as {$row}-kemu1 , so that there is no duplicate name valueok

  • 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.