Re: Pre-loading HTML form w/ mySQL data
| From: | Romulo Roberto Pereira | Date: | Sat, 20 Jan 2001 16:24:15 +0000 |
| Subject: | Re: Pre-loading HTML form w/ mySQL data | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-35806@lists.php.net to get a copy of this message | ||
There you go:
<?php
// DB connection
$dbconnection = mysql_connect ("IP ADDRESS OR HOST+DOMAIN NAME","USERNAME -
DEFULT is root","") or die ("Couldn't connect to Database.");
// Select DB
$database = mysql_select_db ("NAME OF THE DATABASE", $dbconnection) or die
("Couldn't select Database.");
// Query
$query = "SELECT *
FROM <TABLE>
WHERE <COND = TRUE>;
// execute query
$query_result = mysql_query ($query,$dbconnection) or die ("Couldn't execute
query in Database.");
// fetching values with while
while ($row = mysql_fetch_array ($query_result)) {
$VAR1= $row["COLUMN1"];
$VAR2 = $row["COLUMN2"];
<or a FOR tht will fetch all the values (if is more than one) in $VAR1 and
$VAR2>
}
echo"
<FORM ACTION = \"\">
<INPUT TYPE = text NAME=name VALUE=$VAR1>
<INPUT TYPE=text NAME=telephone VALUE=$VAR2>
</FORM>
?>
----- Original Message -----
From: Anthony Rodriguez <sbwi@bellatlantic.net>
To: <php-general@lists.php.net>
Sent: Saturday, January 20, 2001 8:06 AM
Subject: [PHP] Pre-loading HTML form w/ mySQL data
I've a mySQL db with user information (e.g.: name, address, phone, etc.).
I'd like to pre-load an HTML form with the existing user information in
order to enable the users to update some of the information.
Are there any PHP sample scripts that I may look at to do this?
Thank you!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net