I have a text field in my mysql database that is used for notes.

Instead of having the current text echoed in the text area of the form every time is is to be added to, I would like to have the current text showing read only, then a blank text area to add any new notes to.

So I am trying to get a script that will ad the inc the current data from the text field and then add after this the new data, then use the string of the combined data for my form value.

Something like this

//Take it that I have called the database data.

<textarea cols="75" rows="20" id="comments2" name="comments2"></textarea>

$comments = "db text field"; // current data from the textarea in the db
$comments2 = ($_POST['x_comments2']); //data from the textarea on the form
$x_comments = $comments . $comments2; //the joined data to be input into the db

<input name="x_comments2" type="hidden" value="<?php echo $x_comments; ?>">

//The form is to ad data into the db from the hidden field x_comments2

I am able to retain the exsisting data (no supprize) but can I hell as like get any new text input from the textarea form??

I have also googled and googled again, tried and tried again. A little stuck.

Help please.

    Any help with this would be great, please.

      You want to have it all in the text area but one part of the text read only inside the textarea while the rest of the textarea is still active?

      Only possible using javascript.

      I suggest just echoing the value and then letting people ADD to it using the textarea.

        yamarc;10884729 wrote:

        I suggest just echoing the value and then letting people ADD to it using the textarea.

        This is how I wish to do it, but I can not seem to echo the current value to join with the new value to then add back into the database.

          Let me guess... the problem is that no new data is added?

          Look you're doing this all wrong. Why put that data in a hidden field when it's gonna be processed anyway? And you can't access a form variable without sending the form first. That's why $_POST['anything'] would be empty.

          What you're best off doing is something like

          // Form processing page (form action - AFTER the form has been sent)
          $new_content = $_POST['comment'];
          $db_content = $dbRow['comment'];
          $new_content = $db_content.$new_content;
          mysql_query($query_to_update_row_with_new_content);
          
            Write a Reply...