yddib Posted September 3, 2008 Share Posted September 3, 2008 This form is connected to a database and passes information to it. However, I am looking for the info already stored in the database to be in the form when someone clicks on it so they can edit and update it. Any help would be appreciated <html> <head> <title>Update Profile Page</title> <style type="text/css"> form.pos {position:absolute; right: 400px} h2.pos {position:absolute; right: 550px} </style> </head> <body> <h2 class="pos"> <font color="#800000">Update Occupation </font> </h2> <b> <br /> <br /> </b> <form name="update1" action="update1.php" method="post" class="pos"> <b><font color="#800000">Occupation: </font> <br /> <input type="text" name="occupation" size="40" /> <br /> </b><font color="#800000"><b>Company: <br /> <input type="text" name="company" size="40" /> <br /> Description: <br /> <textarea name="description" cols="40" rows="3" /> </textarea> <br /> <br /> <input type="reset" value="Reset" /> <input type="submit" value="Subscribe" /> </b> <h4 align="center"> </h4> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/122561-update-form/ Share on other sites More sharing options...
ngreenwood6 Posted September 3, 2008 Share Posted September 3, 2008 You will have to connect to the mysql database and pull that information. Once it is pulled from the database you can then assign it as a value in the form. Here is an example: <?php mysql_connect("localhost", "user", "password"); mysql_select_db("database"); $query = mysql_query("SELECT occupation from table"); $row = mysql_fetch_array($query); ?> <form name="form" action="post.php" method="post"> <input name="occupation" value="$row['occupation'"> </form> This is just an example but does that help? Link to comment https://forums.phpfreaks.com/topic/122561-update-form/#findComment-632801 Share on other sites More sharing options...
ngreenwood6 Posted September 3, 2008 Share Posted September 3, 2008 You will have to connect to the mysql database and pull that information. Once it is pulled from the database you can then assign it as a value in the form. Here is an example: <?php mysql_connect("localhost", "user", "password"); mysql_select_db("database"); $query = mysql_query("SELECT occupation from table"); $row = mysql_fetch_array($query); ?> <form name="form" action="post.php" method="post"> <input name="occupation" value="$row['occupation']"> </form> The value in the input name is where you show the value. This is just an example but does that help? Link to comment https://forums.phpfreaks.com/topic/122561-update-form/#findComment-632805 Share on other sites More sharing options...
yddib Posted September 3, 2008 Author Share Posted September 3, 2008 Yes thanks that helps. I'll have another go at the code now and hope it works! If not I'll be back! Link to comment https://forums.phpfreaks.com/topic/122561-update-form/#findComment-632811 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.