I have a textarea, and I need to have some sort of button system, like in javascript, that adds a certain block of text to the textarea, but without writing over the current contents of that same textarea. What it will be used for is adding HTML tags to a textarea so that non-html users can automatically enter html tags by clicking on an input-type button.
I know this isnt exactly a PHP issue, but the rest of the program is in php.

I need help, any suggestions?

    Well, the button will submit the form to a PHP script. The PHP script will just take the value that the textarea has and use the concatenaton operator '+' to add to the textarea value. After that, you just put it back to the textarea by doing <textarea><? print $variable;?></textarea>.

    Diego

      yes but the problem is, is that the code I am using has a form button to submit the textarea to another php script to save the information to a txt file, so I cannot have two forms together in one, or else it could only be sent to one php script.

        If you are not shy about using JavaScript to accomplish this, and it sounds like you are not shy...

        <textarea name="textareaX" rows=30 cols=3></textarea>

        <input type="text" name="codefieldX">

        <input type="button" value="Add HTML" onclick="this.form.textareaX.value=this.form.textareaX.value+=this.form.codefieldX.value">

        For example.

        This will produce a textarea, a text input field, and a button. When the button is clicked, anything in the text field will be appended to the end of whatever is in the textarea...all without triggering your form's action, which will be handled later when the user clicks the "submit" button.

        You could also have several of these buttons dedicated to a particular HTML snippet, rather than having a variable text field.

          Oops...use the previous textarea code if you want a tall, skinny textarea..otherwise, of course, make it "rows=3 cols=30".

          = :o)

            Write a Reply...