Start New Discussion within our Web Development Community

hi, another question here. i'm a beginner at php and i need a php script to automatically retrieve data from a database and fill in a form. all the data is in the database and I already have a script to search and return the results.
I just don't know how to generate a form that will be automatically filled from the search.

I hope you can help!

yes you can show database value in textbox....First take a look at this example....

To show value from database into database do the following:-

<head><title>Textbox manipulation</title>
$con = mysql_connect("localhost","root","password")
  die('Could not connect: ' . mysql_error());
mysql_select_db("db_name", $con);

$result = mysql_query("SELECT * FROM Persons");

while($row = mysql_fetch_array($result))
echo "<input type='text' name='name' id='name' value='".$row['name']."' />"

  echo "<br />";


Actually to show value in textbox you can use following...

<head><title>Gallery Script</title></head>
echo "<input type='text' name='name' id='name' value='sad' />"


<input type="text" value=<?php echo "Hi"?>>

Hope it's clear!!!

This article has been dead for over six months. Start a new discussion instead.