This is php/html form textarea code
<textarea name="txtDispMsg" cols="1" rows="1" value="<?php if(isset($disp_msg)){echo $disp_msg;} ?>" <?php if(isset($flag) && $flag == 4){echo "div style = 'border:2px solid red;'" . "/div";}?>></textarea>
here i m checking if user has entered the value in textarea it shall stay there whether there is any other error in form.. so the data in other fields in form stays there.. but not textarea. why?
Am i using wrong method of setting/fixing value to textarea? Though it works in the case of normal text fields
Value is not an attribute of the Textarea tag in HTML syntax. If you want to display content within the Textarea, you must place the content between opening and closing Textarea tags. You are trying to set the content by declaring value=”content” and instead you need to do the following:
SEE: http://www.w3.org/wiki/HTML/Elements/textarea
If you want your values to not clear when you submit, then you must process them at the top of the page looking for some action, and then set the values of them in the form.
Of course you can add your additional logic and styling but the main issue with your code was bad HTML syntax and textarea is different than other form tags and has no ‘value’ parameter.