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:
I do nothing special to the input after:
Then pass it through ajax to php file
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.
Thanks
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:
Code:
<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()" /> </div> </form>
Code:
var chunkTitle= document.getElementById('txtChunkTitle'); var chunkContent = document.getElementById('txtChunkContent'); params = "?chunkTitle=" + chunkTitle.value + "&chunkContent=" + chunkContent.value;
Code:
$chunkTitle = $_GET['chunkTitle']; $chunkContent = $_GET['chunkContent'];
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.
Thanks
Comment