Lee-Bartlett Posted September 27, 2008 Share Posted September 27, 2008 this is what i have so far. <?php require_once("includes/db_connection.php"); ?> <html> <head></head> <body> <form name="form1" method="post"> <select id="names" name="names"> <?php $nameQry = "SELECT * FROM tblbasicform"; $result = mysql_query($nameQry) or die(mysql_error()); while($row = mysql_fetch_array($result)){ echo "<option>". $row['name']; echo "</option>"; $name = $row['name']; $email = $row['email']; $location = $row['location']; $id = $row['id']; } ?> </select> <br> Input First Name: <input type="text" name="firstname" value="<? echo $name ?>" /><br /> Input Email: <input type="text" name="email" value="<? echo $email ?>" /><br /> Input Location: <input type="text" name="location" value="<? echo $location?>" /><br /> Input ID Number: <input type="text" name="id" value="<? echo $id?>" /><br /> <input type="submit" name="submit" value="Update Data" /> </form> </body> </html> Can anyone tell me what to do next please Link to comment https://forums.phpfreaks.com/topic/126073-how-do-i-update-rows-in-a-database-using-a-html-form/ Share on other sites More sharing options...
Andy17 Posted September 27, 2008 Share Posted September 27, 2008 Looooveeeely, I just wrote you a whole script for you but this forum decided to delete it, plus leaving me with no option of going back. Just wonderful. Too lazy to start over again, sorry. Anyways, check this very simple tutorial: http://www.tizag.com/mysqlTutorial/mysqlupdate.php Basically just try and access the entered values from the form by using POST and then putting them into an update query. If you have any problems with it, just ask and I'll see what I can do. Link to comment https://forums.phpfreaks.com/topic/126073-how-do-i-update-rows-in-a-database-using-a-html-form/#findComment-651948 Share on other sites More sharing options...
Lee-Bartlett Posted September 27, 2008 Author Share Posted September 27, 2008 Im quite new to php so not fully with you, ive ran similar code like that before but i didnt see how that linked in with the html form. My drop down box finds my database, and for somereasson in my feilds it finds my bottom entry in my database. One of my problems is, my drop down wont display my database in the feilds and then the update wont work hope this helps for someone who might be able to give me some insight. Even looked in my php book no luck. Link to comment https://forums.phpfreaks.com/topic/126073-how-do-i-update-rows-in-a-database-using-a-html-form/#findComment-651954 Share on other sites More sharing options...
Lee-Bartlett Posted September 28, 2008 Author Share Posted September 28, 2008 bump from page 3 Link to comment https://forums.phpfreaks.com/topic/126073-how-do-i-update-rows-in-a-database-using-a-html-form/#findComment-652375 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.