By pratyk on
Hi,
I developed a module to accept name, email, city, country, age range and languages spoken. out of these, languages spoken and age range are select boxes ... i have no problem with the age range select box (every entry shows up) but the languages spoken select box is displayed blank and i get a warning:
warning: Invalid argument supplied for foreach() in /home/media/public_html/includes/form.inc on line 671.
Any pointers ??? I hope someone can help me out with this ..
thanks ..
Comments
I am guessing the options array is wrong
When you build the select for languages spoken you should be setting '#options' to an array containing the list of spoken languages. My quess is you are either not set '#options' or setting it incorrectly.
thanks but another problem comes up ...
hi,
the options array wasn't set up correctly. i got that part on but now, when i submit the form,
i get this warning:
warning: implode() [function.implode]:
Bad arguments. in /home/media/public_html/modules/cyber_register.module on line 239.
I used the implode function to get the values selected in the select box ..
$agvtxt = implode("\r\n", $form_values['age_level']);
i am completely baffled by this ..
Unexpect code
If you age_level represents a single value, you can retrieve that using
$form_values['age_level'], if it can contain multiple values I use something likeIf you are trying to store the array as a string casting the value to an array will cover the case of no or one response