Hi,
I trying to achieve something that I'm not sure it's even possible (although I tried)
I have an online system for training records, where supervisors can create tests and staff is filling them when required.
When creating test users have three options: textarea, multiple select (checkboxes) and single selection (radios). after the staff fill in the test the data is stored in serialised form, and is being unserialised when view or checked by supervisor.
What i want to achieve is related to text box. On form if user hits enter it takes coursor to new line but when returning data later on from db it all shows as one continues string.
The uploading code looks like that:
foreach ($_POST as $k => $v)
{
if ($k != 'clock_no' && $k != 'policy' && $k != 'testID')
{
$array = array();
$array[$k] = $v;
$prepData = mysql_real_escape_string($data);
$query = (INSERT Statement);
}
}
can I replace the end of line characters with <br> in the array values ($v), or the whole array ($array).
If so how can I achieve it?
I've tried
str_replace('\n','<br>', $v);
and
str_replace('\n','<br>', $array);
but it didn't work.
Or am I simply barking at a wrong tree, so to speak?
Thanks for any help