Page 1 of 1

Displaying database entries in an input text box

Posted: Tue Jul 27, 2010 12:38 am
by K-Z
Hi...I want to know that is it possible to display that data that is stored in the database in a textbox with the help of javascript. I am able to do this with php but the problem is mis-location of the text or data in the textbox. I want to show the data in the text box from the first position. The php code I am using is:

Code: Select all

// suppose I want to show the data stored in '$y' variable in the text box
<textarea name="name" id="2" cols="23" rows="10">
<?php echo "$y"; ?> </textarea>
Is there anything wrong in the php code or mis-location of text can only be prevented using ajax or javascript. If yes, please tell me the solution.

Re: Displaying database entries in an input text box

Posted: Tue Jul 27, 2010 5:04 am
by Gargoyle
don't put $y into quotes.

other than that, you can't (directly) access a database through javascript.

Re: Displaying database entries in an input text box

Posted: Tue Jul 27, 2010 5:06 am
by VladSun
Rewrite your code (HTML+PHP) in a single line ;)

Re: Displaying database entries in an input text box

Posted: Tue Jul 27, 2010 10:41 am
by K-Z
Thank you everyone....I have solved my problem...