php - Multiple Select with Explode: only returns the word "Array" -
By using Wordpress I have created a multiple selection box so that users can select categories to exclude. When the page is initially loaded, I see my predefined default option. However, when I select a new value and I save ... I only see the word "Array" and have not chosen anything else?
& lt; Class = "amultiple" id = "& lt; php echo $ value ['id'] ;? gt;" name = "& gt; php echo $ value ['id'] ;; gt; []" Multiple = "multiple" size = "8" & gt; & Lt ;? Php global option; Foreign currency ($ value as value $) {if (get_settings ($ value ['id']) === FALSE {$$ value ['id'] = $ value ['std']; } And {$$ value ['id'] = get_settings ($ value ['id']); }} $ Ranges = & amp; Amp; Categories ('type = post & orderbiz = name & amp; hide_empty = 1'); If ($ ranges) {$ ex_cat = implode (',', $ tt_cat_exclude); Forex Currency ($ range as category $) {$ selected = (in_array ($ ex_cat, $ category- & gt; cat_ID))? 'Selected =' selected '': ''; Echo '& lt; Option value = "'. $ Category-> cat_ID.' '' $ Selected '& Gt;' . $ Category-> Cat_name '& lt; / Option & gt;' . "\ N";}}? & Gt; & lt; / select & gt; & lt; br / & gt; For test purposes, print variable:
You should use implode () < / Code>
Similarly
$ ex_cat = implode (',', $ tt_cat_exclude);
This is a comma
This line will return
$ selected = (in_array ($ category-> Cat_ID, $ ex_cat))? 'Selected =' Selected '': Changed to
$ selected = (in_array ($ category-> cat_ID, $ tt_cat_exclude))? 'Selected =' Selected '': ''; $ ex_cat
Tring and can not be used in In_are () $ ex_cat
Now I feel redundant.
Comments
Post a Comment