![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 | |
Confirmed User
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,116
|
![]() Ive seen this done in the past but I dont recall where, so cant find the source code to make it happen.
What I want to do is give a user a drop down option, which they select, it then stores that option in an SQL database. The next time they return to the page, it shows them what option they chose but also the possibility of changing it in the drop down, for example: Quote:
The next time they hit the page with this dropdown on it, the form automatically shows 'Google' as the chosen option. How would I go about doing this on a php page, pulling the option they initially chose from the database? Thanks.
__________________
NOTHING TO SEE HERE |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Industry Role:
Join Date: Sep 2013
Location: The Netherlands
Posts: 805
|
Get the value from your database:
SQL query... select from xxxx where user etc... Store it in a variable, for example $usersearchOption = ''; Put the options in an array: $searchOptions = array('Google','Bing','Yahoo','YoMomma'); Loop through options in array, if a match with the database entry, add "selected": foreach ($searchOptions as $value) { if($value == $usersearchOption) echo "<option selected='selected' value='".$value".'>".$value."</option>"; else { echo "<option value='".$value."'>".$value."</option>"; } // end of else } // end loop Then, add a submit button below and update the new value in database (if the user submitted a change). |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 | |
Confirmed User
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,116
|
Quote:
![]()
__________________
NOTHING TO SEE HERE |
|
![]() |
![]() ![]() ![]() ![]() ![]() |