Reputation: 11
Html tag automatically added textarea value if form submitted through Jquery.
My jquery code.
$('#calling').click(function() {
$('#myform').submit();
});
In my form one text area is there.
<textarea id="area" name="rte1" cols="50" rows="10">Value of textarea.</textarea>
Javascript code as below.
document.myform.submit();
In case of jquery form submit i am getting textarea value in PHP as
<p>Value of textarea.</p>
But in case of java script form submit i am getting the proper value in php.
Please suggest what is the problem with my jquery code.
Upvotes: 0
Views: 746
Reputation: 12161
There is no problem at all with your jquery code. Tested with POST and GET methods and the server only gets the "Value of textarea." string. You must have something wrong in your PHP.
document.myform.submit();
$('#myform').submit();
Those produce the same result.
Upvotes: 0
Reputation: 3622
Well a simple way in php
to get the value without any HTML Tag
$textarea = strip_tags($_REQUEST['rte1']);
This will return you Value of textarea.
without <p>
tags.
See Manual if you need any more help.
Upvotes: 0