1,105,534 Community Members

textfield manipulation

Member Avatar
leechang.kevin
Newbie Poster
3 posts since Jan 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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!

Member Avatar
IIM
Master Poster
742 posts since Jun 2011
Reputation Points: 163 [?]
Q&As Helped to Solve: 169 [?]
Skill Endorsements: 24 [?]
 
0
 

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

<?php
<html>
<head><title>Textbox manipulation</title>
</head>
<?php
$con = mysql_connect("localhost","root","password")
or
  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 />";
  }

mysql_close($con);
?>

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

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

OR

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

Hope it's clear!!!

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: