PHP get dropdownlist select option value

后端 未结 4 1314
醉话见心
醉话见心 2020-12-18 08:14

In my dropdownlist I have two different values for each option. How can I retrieve both? Let me illustrate what I mean.


  

Then when you process it you can do this or maybe even something more simple:

foreach ($_POST['my_dd1'] as $value_Id => $value_text) {
  $value_Id = $value_Id;
  $value_text = $value_text;
}

Because php treats the [] as meaning the string is an array and so you instantly have an associative array. I agree though that if you put it there in the first place you ought to be able to just look it up again in the code rather than rely on this.

提交回复
热议问题