I have a question here on how to parse a $POST_['value'] (e.g 3785,3789,3790,3787 )
from a form to an array($POST_['value'])
and do foreach. Please see the sample code below:
function someFunction(){
$html = '';
$int = $_POST['Ids']; //POST the value as 3785,3789,3790,3787
$IDs = array($int);
foreach ($IDs as $ID) {
$intVal = '<int>' . $ID .'</int>';
$html .= $intVal;
}
return $html;
}
however the result displays it as the ****whole string** rather than array**.
And if I put the array(3785,3789,3790,3787)
like this, it will parse as array in foreach. How to convert the $POST_['IDs']
to number or some sort in order to be recognised as array?
Thanks
Mike