The following warnings occurred: | ||||||||||||||||||||||||
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
|
multiple select box or checkboxes in the registration form - Printable Version +- UserSpice (https://userspice.com/forums) +-- Forum: Miscellaneous (https://userspice.com/forums/forumdisplay.php?fid=28) +--- Forum: Modifications and Hackery (https://userspice.com/forums/forumdisplay.php?fid=29) +--- Thread: multiple select box or checkboxes in the registration form (/showthread.php?tid=345) |
multiple select box or checkboxes in the registration form - LBC - 11-15-2016 This is the link for the join.php http://hastebin.com/maralegaci.xml and this for the user_settings.php http://hastebin.com/povorokova.sm Again, what I like to have is for someone to select some stuff (i.e. check boxes or select from a multi select box) which then gets stored along with all the other join data in the DB and their Profile. So what they selected needs to show up in their profile and public profile. Also they need to be able to change their choices in "Edit your account info" (user_settings.php). On that page it should show what they have selected during their joining process (or after previous updates to their profile), and it should be possible to update it. I hope that makes sense multiple select box or checkboxes in the registration form - mudmin - 11-15-2016 Ok. I'm going to be in a meeting for a few hours, but I will definitely check it out. multiple select box or checkboxes in the registration form - LBC - 11-15-2016 Oh thank you so much Mudmin. You are the best! multiple select box or checkboxes in the registration form - mudmin - 11-16-2016 Ok. Here we go. You had too many changes to the user_settings for me to do a full test on that, but I have the details worked out. You definitely should be doing these custom version of the userspice files in the usersc folder so that our updates don't break your changes. This is my usersc/join.php file (with the standard header instead of yours because I didn't have a copy of yours. http://hastebin.com/ezuvotebaq.xml Then...all you need to do for your user_settings.php is get rid of all your other logic for those 3 fields and right after die('Token doesn\'t match!'); }else { add this... http://hastebin.com/tizabeluju.php The code's a little repetitive, but it should work reliably multiple select box or checkboxes in the registration form - LBC - 11-16-2016 Hmm, it doesn't seem to update the DB through user_settings. When I now fill in the join form everything looks okay. After I checked the last two boxes it says in the DB 0 1 1. When I go to the edit account those two boxes appear as checked. When I then check the first box and press update...the DB changes to 0 0 0 (de-checking all the boxes). I wonder if it has to do with that $moreInfo part. It says that a couple of times in both join.php and user_settings.php, but I do not have such a column in my DB. In my DB I have added three columns after the "company" one (over_18, love_us and am_human). multiple select box or checkboxes in the registration form - mudmin - 11-16-2016 Yeah. I couldn't test your particular user_settings.php last time. Ok. Here's what I did. I made a new user_settings.php that is designed to go in the usersc folder and then only added the checkbox feature. One of the issues is that you need the page to refresh when you submit in order to recheck/uncheck the boxes on the page. Because of this, I did a more generic "settings updated" message if all the validation passes so I can show the message after the refresh. Here's the link that works for me. Then you can go back and add those other fields like country. http://hastebin.com/lagizihoxe.scala Also, just to make sure we're on the same page, those db_columns are int(1) in the database. multiple select box or checkboxes in the registration form - LBC - 11-17-2016 OMG! Totally works! Awesome! ))) Thank you SO much Mudmin! Now I can finally continue and perhaps even finish my website. I will let you know the end result multiple select box or checkboxes in the registration form - LBC - 11-17-2016 Okay, I have almost everything working smoothly now thanks to you. One more thing though )) Would it be possible to do a keyword search (or even a search by checking boxes) to display users whom have checked certain boxes in their profile? So far I have been doing searches for specific words that are in a DB column (like a country or city), but this is not the case for my checkboxes now as they only display 0 or 1. Is there a way to incorporate column names into my search form? multiple select box or checkboxes in the registration form - mudmin - 11-17-2016 If you have a limited amount of searchable fields, would a dropdown box of the options work? So the dropdown would have the over_18, love_us or whatever in there and a go button that fires off the query? AJAX would be ideal for this, but I'm terrible at that, so it would be pretty easy to just refresh the page on go and fire off that query. OR One thing you could do is some sort of table sorter that lets you filter people that way. I'm not sure if you're starting with an entire table with all the users and they are filtering from there or if you are starting with something blank and only allowing them to see results they ask for. If there is a whole table, you could create the table with something to convert the 1 or 0 back to yes or no and then you could use this plugin http://tablesorter.com/docs/ That allows people to multisort the columns (They can even control click to get all the people who are over 18 and THEN people who love userspice. Just a thought. multiple select box or checkboxes in the registration form - LBC - 11-17-2016 Well, what I have now is what you created for me a little while back. A search field that looks in the users row in the DB. I can look for country, name, city etc. I would now like to be able to search for over_18, love_us and am_human as well. This could either be through keywords that look like the actual data stored or by checking certain boxes and then press go resulting in displailying users that have had the same boxed checked. It would be fine if it becomes a search form (with multiple keyword entry areas and checkboxes) instead of just one search field. The search option is kind of the main feature of my site, as I am trying yo match people (make them find each other through searches). What you write about last seems promising though. It would be great if you could first search for anyone in lets say France, and then refine that search to users who love_us or whatever. I don't want to be fiddling with Ajax though, as I've never done anything with that. I can work well with stuff I can copy and paste and expand upon it. This is why your help has been so valuable to me. You made a bases upon which I can expand. So...a form where you can do multiple search queries would be good I think. If you have any ideas or pointers for that, that would be great help |