I want to add to some form the code editor EditArea

I connect and use it in this way:

<script type="text/javascript" src="editarea/edit_area/edit_area_full.js"</script> <script type="text/javascript"> editAreaLoader.init({ id : "text" // textarea id ,syntax: "php" // syntax to be uses for highgliting ,start_highlight: true // to display with highlight mode on start-up ,replace_tab_by_spaces: "2" ,allow_resize: "both" }); 

 <textarea id=text name=text cols="80" rows="15" style='width: 100%;'></textarea> 

The problem is that I can not pull the text out of the text box in order to write it to a file. To do this, apparently, you need to use a specific function. I understand that this one:

enter image description here

But how exactly - I can not understand. In js is not strong at all. Suddenly, who faced it with this code editor, or with some other. Or just know js. Please help me figure out how to pass text from the EditArea text field to the php variable.

    1 answer 1

    I don’t know exactly this editor, but I assume that it works like everyone else, and that is, the <textarea></textarea> should be placed in the <form></form> and sent using the <input type="submit"> tag <input type="submit"> . It looks like this:

     <form method="GET" action="test.php"> <script src="editarea/edit_area/edit_area_full.js"></script> <script> /* закоментировано что бы не вызвать ошибку, потому что нужно указать js файл с вашим редактором editAreaLoader.init({ id: "text" // textarea id , syntax: "php" // syntax to be uses for highgliting , start_highlight: true // to display with highlight mode on start-up , replace_tab_by_spaces: "2", allow_resize: "both" }); */ </script> <textarea id="text" name="text" cols="80" rows="15" style="width: 100%;"> </textarea> <br> <input type="submit" value="отправить на обработку"> </form> 

    in this example, the data from the textarea will go to the test.php file there and you need to catch it

    • The fact is that in this way nothing is sent. This method works if you use the usual textarea . And to transfer the text from this code editor you need to use the function that I gave. But how to use it correctly, I can not understand. - luckydutch
    • is sent, paste the code in html into your page and click the send button, then in the address bar see what comes after test.php - this is the data from textarea , and in the php page it will be stored in the global GET array ($ _ GET [" text "]). - perfect