Jump to content

Adjust Lines in Textarea


Recommended Posts

Guest MrLeN

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).

Link to comment
https://forums.phpfreaks.com/topic/242408-adjust-lines-in-textarea/
Share on other sites

Guest MrLeN

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..

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.