multiple select error

June 22, 2006 at 3:02 pm Leave a comment

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 😀 hehe.. need to get back to work ..

Advertisements

Entry filed under: baking tips, cakephp.

new installation of cake: open_basedir restriction error Cakphp Cheat Sheet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Recent Posts

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

%d bloggers like this: