<b>Fatal error</b>: Cannot use [] for reading
This code doesn't work > <b>Fatal error</b>:  Cannot use [] for reading i
  <select style=" width:200px" class="mydds"  name="myformdata[user][]">
this is what is sent.
myformdata[user][开发者_Python百科]  1
myformdata[user][]  2
myformdata[user][]  3
  foreach($form['user'][] as $val){
            echo ($val);
    }
what is the problem ?
It's a syntax error. The correct syntax is:
foreach($form['user'] as $val)
The [] syntax is used for appending data to an array. For example:
$form['user'][] = 'test';
The above will add a new string to the $form['user'] array with the value of test.
foreach($form['user'] as $val){
    echo ($val);
}
Your syntax is wrong. Others are suggesting foreach(), I will suggest a for() loop in addition:
for ($i = 0; $i < count($form['user']); $i++){
    echo ($form['user'][$i]);
}
The result of the posted information (if I understand your explanation correctly) is:
$_REQUEST['myformdata']['user'] = array(1,2,3)
As the error states very clearly, you cannot use [] for reading.  When you use foreach, the code is trying to read the value before as.  It can't read with [].  Instead try:
foreach ($_REQUEST['myformdata']['user'] as $val) { echo $val; }
Or if the information really is in $form['user'] just use that and skip the []
 加载中,请稍侯......
      
精彩评论