Guest MrLeN Posted July 20, 2011 Share Posted July 20, 2011 I have a problem, and I can't think of an easy solution. I have a text file that members of a website can edit with a textarea. I do not want them to be able to edit the content of the textarea, except to rearrange the lines. ie: <start textarea> a big blue turtle a green cat a purple giraffe <end textarea> I want them to be able to move (for example) a purple giraffe from position 3 to position 2. I do not want them to be able to change the actual text. I think what I want to do is rather complicated. But hopefully someone will know exactly what to do and it wont be so hard. The contents of the textarea comes froma text file, which is included by php. Basically, what I am trying to accomplish, is to find a way to allow the person submitting the forum to rearange the lines of the text file, so that once they have submitted the form, the lines of the text file will appear in a different arrangement (accoring to the will of the person that submitted the form). It is important that the person editing the text area does not change the actual text (only the positions of the text). Quote Link to comment https://forums.phpfreaks.com/topic/242408-adjust-lines-in-textarea/ Share on other sites More sharing options...
Guest MrLeN Posted July 20, 2011 Share Posted July 20, 2011 Maybe, when PHP reads the text file, instead of displaying it in a textarea, maybe it could be ordered into some sort of array (not that I know how to do that), and then each option could be displayed in a dropdown? Then, someone can select the line they want to reposition and enter a new number for the line in an input are? ie: <select> <option>a big blue turtle</option> <option>a green cat</option> <option>a purple giraffe</option> </select> Then have a place to put a number, ie: <input type="text" name="position"> Then, once the person has selected a line and entered a number for the position, php will then rewrite the text file accordingly? But how to actually write the code for that, I have absolutely no clue.. Quote Link to comment https://forums.phpfreaks.com/topic/242408-adjust-lines-in-textarea/#findComment-1245004 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.