Page 1 of 1

php + javascript

Posted: Wed Mar 21, 2007 9:10 am
by nairrakesh007
i have a form with a textarea..now i want to assign an initial value to it using javascript..the value will be fetched from a database(mysql)and assigned to a php variable...
the code is somewhat like this...
<form name="info"id="f1">
<textarea name="content" id="t1" value="<?php echo("$content"); ?>";></textarea>
</form>

this code is not working..

i also tried accessing the textarea from javascript

document.info.content.value=<?php echo("$content");?>;


this is also not working...the value stored in $content does not get displayed in the textarea when i load the page

can anyone help me out on this..

Posted: Wed Mar 21, 2007 9:20 am
by feyd
A <textarea>'s value is placed inside the container.

Posted: Wed Mar 21, 2007 11:32 am
by mikeq

Code: Select all

<textarea>Your variable will go in here, not a value attribute</textarea>