Andromeda Andromeda - 1 month ago 7
PHP Question

Converting content of text area into an array

I have a form with a text area in html.
I want to get the content of this text area in php so that each line can be stored in an array. I tried using implode with'/n'. but its not working. how can i do that.

Here is my code

$notes = explode('/n',$_POST['notes']);

Answer

You need to use this:

$notes = explode("\n", $_POST['notes']);

(Back slash, not forward slash, and double quotes instead of single quotes)