First of all, I think you should have posted this topic in the PHP forum.
Secondly, I don't think I quite understand. Do you want a pair of textareas per pair of heading/contents? Or do you want 2 textareas in total: one holding all the headings, and one holding all the contents such that the lines of headings correspond with the lines of the contents?
What do u mean by linking and future history of links? Do you mean that you want to create a series of links, each will jump to a particular area of the textarea?