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...

Recommended Answers

All 9 Replies

http://www.w3schools.com/php/php_mysql_select.asp Check this. Instead of echoing $row and $row 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; ?>">

commented: helpful post +5

http://www.w3schools.com/php/php_mysql_select.asp Check this. Instead of echoing $row and $row 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; ?>"> ?

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

Or u can write as

echo "<input type='text' name='name' value='$firstname'>";

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

<input type="text" name="name" value=<?php echo $name; ?>><br/> 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

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

<input type="text" name="name" value=<?php echo $name; ?>><br/> 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 used echo "<tr><td>Reg.No.:</td><td width='200'><input type='text' name='reg' value=".$row[RegNo]."></td></tr>";

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 "<tr><td>Reg.No.:</td><td width='200'><input type='text' name='reg' value=".$row[RegNo]."></td></tr>";

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.