954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

how to insert database value to a textbox

hi i'm a newbie in php, plz help me with this.
how can i put the value of my database to a textbox?
can u give me a sample code..
thx...

zidaine
Newbie Poster
5 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

http://www.w3schools.com/php/php_mysql_select.asp Check this. Instead of echoing $row['FirstName'] and $row['LastName'] in the example, assign it to a variable and use it as the 'value' of the textbox.
<input type="text" name="firstname" value="<?php echo $firstname; ?>">

nav33n
Purple hazed!
Moderator
4,465 posts since Nov 2007
Reputation Points: 524
Solved Threads: 356
 
http://www.w3schools.com/php/php_mysql_select.asp Check this. Instead of echoing $row['FirstName'] and $row['LastName'] in the example, assign it to a variable and use it as the 'value' of the textbox. <input type="text" name="firstname" value="<?php echo $firstname; ?>">


thx nav33n. but how about textboxes inside a <?php ?> tags? do i have to echo <input type="text" name="firstname" value="<?php echo $firstname; ?>"> ?

zidaine
Newbie Poster
5 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

textbox inside <?php tags ? Yep, you have to echo it. But this way.
echo "<input type=\"text\" name=\"name\" value=\"$firstname\">";

nav33n
Purple hazed!
Moderator
4,465 posts since Nov 2007
Reputation Points: 524
Solved Threads: 356
 

Or u can write as

echo "<input type='text' name='name' value='$firstname'>";
jino
Junior Poster
117 posts since Feb 2008
Reputation Points: 10
Solved Threads: 10
 

if i insert data into text box how can i retive that data via combo box using php

vijiv
Newbie Poster
1 post since Oct 2009
Reputation Points: 10
Solved Threads: 0
 

>
hear it is the php code but i can't access full name it only print the first part of the name can u help me pls? but i can access full name from $name in outside the input label

sebin george
Newbie Poster
2 posts since Jul 2011
Reputation Points: 10
Solved Threads: 0
 

how to insert paging into a php script, and how it is worked and how can we insert values to pages

sebin george
Newbie Poster
2 posts since Jul 2011
Reputation Points: 10
Solved Threads: 0
 
>
hear it is the php code but i can't access full name it only print the first part of the name can u help me pls? but i can access full name from $name in outside the input label

While displaying the data from the database on a text box, I can access only the first part of the name. You had the same problem it seems. Did you find any solution for that? I need to access the whole data.
This is the code i've usedecho "Reg.No.:";

Persi
Newbie Poster
17 posts since Feb 2012
Reputation Points: 10
Solved Threads: 0
 
textbox inside <?php tags ? Yep, you have to echo it. But this way. echo "<input type=\"text\" name=\"name\" value=\"$firstname\">";

While displaying the data from the database on a text box, I can access only the first part of the name. For example, if the name is 'Five Star', only the name 'Five' is displayed. Can you help in this? I'm just a beginner.
This is the code i've used echo "Reg.No.:";

Persi
Newbie Poster
17 posts since Feb 2012
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You