breaking data apart from HTML form textarea with PHP
Posted: Fri Feb 08, 2008 1:09 pm
Greetings:
I am working on a database driven application and this includes a form that the user submits.
I have a standard textarea in the form and i want to break the data out into an array (for insertion into a MySQL database) based on the return (\n).
In case my explanation is lacking, here is an example of what I would like to do:
here is the output of my form:
outputs 1 some foo 4:05 2 more foo 5:01 3 even more foo 3:30 ...etc.
I am looking to break each of these items into their own variable like somearray[0]= 1 some foo 4:05 somearray[1] = 2 more foo 5:01 and so on...
The textarea should have returns between each track entered.
Can someone please help me write the code that will do this?
Thanks,
Mike
I am working on a database driven application and this includes a form that the user submits.
I have a standard textarea in the form and i want to break the data out into an array (for insertion into a MySQL database) based on the return (\n).
In case my explanation is lacking, here is an example of what I would like to do:
here is the output of my form:
Code: Select all
echo $_POST[tracks];outputs 1 some foo 4:05 2 more foo 5:01 3 even more foo 3:30 ...etc.
I am looking to break each of these items into their own variable like somearray[0]= 1 some foo 4:05 somearray[1] = 2 more foo 5:01 and so on...
The textarea should have returns between each track entered.
Can someone please help me write the code that will do this?
Thanks,
Mike