assign database result to iinput text box
| From: | iccsi | Date: | Wed, 18 Sep 2013 05:33:32 +0000 |
| Subject: | assign database result to iinput text box | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-322078@lists.php.net to get a copy of this message | ||
I have following html code to show my input text box and php to connect server and select result from database server.
I would like to know how I can I use php to assign the value to my input text.
Your help and information is great appreciated,
Regards,
Iccsi,
<INPUT type="text" name="Mytxt" id="MytextID" />
<?php
$username = "root";
$password = "myPassword";
$hostname = "localhost";
//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";
//select a database to work with
$selected = mysql_select_db("iccsimd",$dbhandle)
or die("Could not select aerver");
//execute the SQL query and return records
$result = mysql_query("SELECT invid, invdate, note, amount FROM invheader");