Have data in mySQL database be reflective of what's displayed in a drop down menu.

Mourlsmussy

New Member
Thanking you for taking the time to look at this question.The premise of the situation is that I have a "website" written in PHP and HTML that displays items from my database named "Spreadsheet." There are six columns, and over 4000+ rows of data. The columns are "accountID", "accountName", "website", "rating", "imageURL", "comments." The column "rating" in the website is a drop down list.Currently, everything works well, but I have do questions:[*]How do I, with PHP, have data submitted to the database upon clicking on an option (such as "Very Bad") in the drop down list? At the moment, it requires the user to click a "submit" button, which refreshes the page entirely, losing their position. Is it possible to have it submit silently (without refreshing)[*]Second question has to do with the drop-down list again. How do you have the drop-down list display what's in the database? For example, if rating is "Very Bad" in the database, the drop-down list reflects that, and not what the first element is. Below is my code.\[code\] <a href =http://stackoverflow.com/"". $urlHTTP, $row['website']."\">". $row['website']."</a><br /> <Form Name =\"rating\" Method =\"POST\" ACTION =\"\" /> <input type = \"hidden\" name=accountID value="http://stackoverflow.com/questions/13753653/. $row['accountID'] . "> <select name=\"rating\"> <option value=http://stackoverflow.com/"\"></option> <option value=http://stackoverflow.com/"Very Bad\">Very Bad</option> <option value=http://stackoverflow.com/"Bad\">Bad</option> <option value=http://stackoverflow.com/"Average\">Average</option> <option value=http://stackoverflow.com/"Above Average\">Above Average</option> </select> <INPUT TYPE =\"Submit\" Name =\"formSubmit\" VALUE =http://stackoverflow.com/"Submit\">if (isset($_POST['formSubmit'])){ $rating = $_POST['rating']; $accountID = $_POST['accountID'];var_dump($rating);var_dump($accountID);if(!mysql_query("UPDATE Spreadsheet SET rating='$rating' WHERE accountID='$accountID'")) {echo 1;}} mysql_close();?>\[/code\]Thanks so much! This question has been bothering me for a bit. I have tried many Google attempts, but I could not find an answer as specific as I am asking. Thank you so much.
 
Back
Top