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>'; } } ?> Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.