November 9th, 1999, 08:11 AM
Time spent in forums:
This is a very simple procedure.
You just have to read the relevent record from the table and use the fields as value in the HTML <input> tags.
To keep this short, I'm assuming you've connected to the db and that $name contains the users name:
$result=mysql_query("select name,address,city,zip,phone from info where name='$name'");
<form action="changeinfo.php3" method=post>
<input type=hidden name="oldname" value="<? print $data[name] ?>">
NAME:<input type=text name="name" value="<? print $data[name] ?>">
Address:<input type=text name="address" value="<? print $data[address] ?>">
// you get the idea
then in changeinfo.php3 (assuming you've checked the validity of the entries) you can use this query:
"replace into info values ('$name','$address','$city','$zip','$phone') where name='$oldname')"
Using the $oldname allows the user to modify the name and still update the old record. However, using a unique index for this would be better.