multiple select error

June 22, 2006

Problem: when i try to use a multiple select tag, I always encounter this error after i submit the form
Warning: htmlspecialchars() expects parameter 1 to be string, array given in /path/to/cake/lib/cake/basics.php on line 436

Obviously, its asking for string instead of array (which is what the mulitple select tag will pass) . So, i just change it to accept array..

function h($text) {
if (is_array($text)) {
foreach ($text as $val) {
$new[] = htmlspecialchars($val);
}
} else {
$new = htmlspecialchars($text);
}
return $new;
//return htmlspecialchars($text); // this is the old code

}

Another problem: it cannot automatically select the selected items.

Solution: I’d post this some other day :D hehe.. need to get back to work ..

Entry Filed under: baking tips, cakephp. .

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Top Posts

Recent Posts

a

bakers

feeds

general

uncategorized

Archives

Recent Comments

reviews on About
vishal on CakePhp Coding Standards
Ezoteraa on new installation of cake: open…
lanamep on new installation of cake: open…
marthavos on new installation of cake: open…

 

June 2006
M T W T F S S
    Jul »
 1234
567891011
12131415161718
19202122232425
2627282930  

Meta