Hi guys,

I cant seem to work out a way to keep my paragraphs when using a text area as part of a form.

I send the form using ajax and then display the text again in a textarea to allow editing before finally displaying it on a standard page.

This is the form I am currently using:

<form action="javascript:insertChunk()" method="post" >
<h3>Chunk Name<br />
<input type="text" id="txtChunkTitle" name="txtChunkTitle" length="42"/></h3>
<h3>Chunk Description<br />
<textarea type="text" name="txtChunkContent" id="txtChunkContent" cols="30" rows="15"></textarea></h3>
<div id="addChunkBut">
<input type="button" name="submit" value="Click To Create Chunk" onclick="insertChunk()" />

I do nothing special to the input after:

var chunkTitle= document.getElementById('txtChunkTitle');
var chunkContent = document.getElementById('txtChunkContent');
params = "?chunkTitle=" + chunkTitle.value + "&chunkContent=" + chunkContent.value;

Then pass it through ajax to php file

$chunkTitle = $_GET['chunkTitle'];
$chunkContent = $_GET['chunkContent'];

I then store that into the database using a standard insert into sql statement.

I have tried playing around with various things i have seen on the net but to no avail so thought id show the base form and see if someone knows how to do this or if its possible.


7 Years
Discussion Span
Last Post by Ezzaral

Solved using escape() before sending via AJAX

Please mark thread close/solved

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.