unistake Posted November 11, 2010 Share Posted November 11, 2010 Hi all, I am trying to make a members details section that can be updated. I want to be able to "SELECT * FROM users WHERE email='$email'" and then show the values that can be changed in a html drop down box with the selection that was made when the user registered already selected="selected"; You will be able to see what I am attempting to do below. <?php $sql = "SELECT manufacturer FROM table1 WHERE email=$'email'"; $result = mysqli_query($cxn,$sql); $row = mysqli_fetch_assoc($result); foreach manufacturer in table1 { if table1.manufacturer = table2.manufacturer { echo '<option name="manufacturer" selected="selected" value"$row['manufacturer']"</option>'; } else { echo '<option name="manufacturer" value"$row['manufacturer']"</option>'; } } ?> Link to comment https://forums.phpfreaks.com/topic/218371-show-value-from-a-mysql-table-selected/ Share on other sites More sharing options...
upp Posted November 11, 2010 Share Posted November 11, 2010 put an html <form> tag around the options and when they press the submit button which you could label as "update" or something of that nature have it send them to a page you could save as update.php. in update.php run the sql statement of UPDATE to update your database, here is a tutorial on it. http://www.w3schools.com/sql/sql_update.asp Link to comment https://forums.phpfreaks.com/topic/218371-show-value-from-a-mysql-table-selected/#findComment-1132961 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.