php + javascript

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
nairrakesh007
Forum Newbie
Posts: 1
Joined: Wed Mar 21, 2007 9:05 am

php + javascript

Post 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..
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

A <textarea>'s value is placed inside the container.
User avatar
mikeq
Forum Regular
Posts: 512
Joined: Fri May 03, 2002 3:33 am
Location: Edinburgh, Scotland

Post by mikeq »

Code: Select all

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