textarea input into multiple rows


#1

So I’ve been asked by a friend if I could help her with a php/sql database for a sim game site that she has. What she asked me is to set up what she refers to as a ‘show results database’. This database will include all information about ‘shows’ ran in the game. She wants the show results database to be displayed on individual competitor pages. I am able to do this. I’ve got this all written and completed.

However, what she also wants included is a php form that inserts into the database. Simple enough. Except, instead of doing it individually for each show (which contains ‘classes’ therefore entering each class seperately with the results, she wants a text area where she can copy and paste the results and be done.

My question is how would I go about creating a textarea form that will submit each line of data in that text area to a seperate row and correspond with the columns?

The columns go as follows:

show_id | show_name | class_name | competitor | place

So I would need data entered into a text area in this format:

Show 1
Class Name 1
1st Competitor A
2nd Competitor B
3rd Competitor C
4th Competitor D

To correctly enter into the row above and the table would than appear as such

show_id | show_name | class_name | competitor | place

1 | show 1 | class name 1 | competitor a | 1st

Any help on how I would go about doing this would be greatly appreciated!


#2

is a little bit complicated you must parse the text with php …
why dont you create a form instead?


#3

Well ultimately it will be a form. What she wants is a form that will help her to not sit for an hour inputting data which ultimately would be a copy and paste text area, hit submit and be done.

I don’ t need a script but if I could know what kind of things I should be looking at tutorial and guide wise, I’m sure I could figure it out.


#4

Very simple… Just use TinyMCE. You can find it at http://www.tinymce.com

It is a simple What-You-See-What-You-Get textarea. It works so well and is easy to set up.
You basically create a textarea and tag it as a “tinymce” area. Then, do whatever you want
with it, sort of like MS-WORD. BOLD/ITALICS/IMG’s, etc are all converted to a HTML format
automatically. So, to save it into a database your basically use the textareas value and just
save it. Works extremely well. I have experimented with it and find that for your type of
needs, just use the “BASIC” or “SIMPLE” version. Will save you TONS of time.

So, please check it out and let us know it is works for you… Good luck…


#5

Thanks ErnieAlex!

I haven’t figured out how to get TinyMCE to submit to separate columns from one text field however I’ve found a ton of ways TinyMCE is becoming very helpful and have been able to find another work around from spending hours entering data with using TinyMCE.

So thank you!


#6
I haven't figured out how to get TinyMCE to submit to separate columns from one text field

Do you mean you want to break up things inside of the textarea controlled by TinyMCE and send them to separate fields? A simple way would be to add some sort of “break” code, “”, lol… Or something that she could copy-paste or even better, just a button that would add a break code to between her cut-and-paste entries. She could paste, press the break-button which would add the code.
Then, when it is submitted, you can decode it with a PHP EXPLODE command into an array and use a for clause to go thru the array creating a separate output for each text in the array. That would work quickly and easily… Just an idea… Good luck…