PCHomepage
Programmer
I'm submitting multiple values from a select box, then retrieving them as a comma-separated list but, short of using str_replace, is there a better way to remove the [] that each value has?
I was expecting values like: Mon,Tue,Fri but it is giving Mon[],Tue[],Fri[].
I was expecting values like: Mon,Tue,Fri but it is giving Mon[],Tue[],Fri[].
PHP:
if(isset($_POST['DaysAvail'])) {
$DaysSelected = array();
foreach($_POST['DaysAvail'] as $val) {
$DaysSelected[] = (string) $val;
}
$DaysSelected = implode(',', $DaysSelected);
echo "Day values are :- ".''.$DaysSelected;
exit;
}