Jump to content

trim() function


Danny620

Recommended Posts

i have a function that trims all post data

 

$trimmed = array_map('trim', $_POST);

 

however because i am subminting a post array like

 

[locations] => Array
                (
                    [0] => Oldham
                    [1] => Royton
                    [2] => Delph
                    [3] => Cheadle
                )

 

it gives me an error saying

 

An error occurred in script 'C:\xampp\htdocs\admin\create_listing.php' on line 23: trim() expects parameter 1 to be string, array given 

 

how can i stop this all other data is posted in a string however the locations one is posted in an array

Link to comment
https://forums.phpfreaks.com/topic/222676-trim-function/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.