[thelist] RE: Arrays and Multiple Select?

Les Lytollis les.lytollis at morse.com
Thu Oct 11 10:55:28 CDT 2001


Name your select box "Type_Of_Event[]" and bingo! php knows it has an array
to handle

Incindentally, if you use $HTTP_POST_VARS as the array in the while loop,
you can see exactly what your form is posting.

HTH
Lez
> This gives me the following error message:  
> 
> "Variable passed to each() is not an array or object in
> /export/web/company/philamuseum/public_html/information/develo
> pment/thankyou
> .php3 on line 23"
> 
> I find this encouraging actually. Any idea how to correct this?
> Thanks Malcolm
> 
> ==============================================================
> ==========
> <?php
> 
> while(list($key, $value) = each($Type_Of_Event)) {   
> =====line 23is here!
>        echo "$key = $value<br>";
>        }
> 
> 


<TIP Type="PHP" Author="Lez">
If you often use n-dimensional arrays in your code this is a handy little
helper function you can use to see what going on

<pre>
  <?php
    function get_array_elems($arrResult, $where = "array") {
      while(list($key,$value)=each($arrResult)) {
        if (is_array($value)){
          get_array_elems($value, $where . "[$key]");
        }
        else {
          echo "$key=$value<br>\n";
        }
      }
    }  
  ?>

</pre>

</TIP>









More information about the thelist mailing list