Front End - Choose from multiple records with checkboxes with selection limit

2 posts by 2 authors in: Forums > CMS Builder
Last Post: March 31, 2015   (RSS)

By MatrixHyperLoop - March 19, 2015

Hi Guys,

I have a project I'm starting and one of things I will be doing is using a front end editor for members to manage the site rather than the CMSB Admin ( I am reserving that only for admins)

This is for a fantasy sports league website.

Users who would be playing in the fantasy league would be choosing from players (user accounts with type set as player) to assemble their fantasy team.

I was thinking of using checkboxes with ability to select up to 5 players so it would need to count and not allow members to choose more than 5 players.

Would this work just a regular checkbox passing the values 0 - 1, OR would this be better suited to use a method similar to the favorites plugin where it creates a record and refs by usernum?

Any advice or code snippets would be awesome!

Thanks!

By gregThomas - March 31, 2015

Hi,

If I was implementing this system, I'd store the players chosen by users in a separate section to the player. I've attached an example of how I'd a link the sections together (the members would be your front end players). You'd have to use the mysql_count function to ensure that users don't have more than 5 players stored against their account. 

Using checkboxes to allow users to select 5 players would work fine, the only potential issue I can see with that system is if you have hundreds of players that site users have to filter through to find the players they want to use. 

Although you could use the Favourites plugin to build this system, you'd have to modify it to only allow users to save 5 favourites and it would have less flexibilty, so it might be better better to build your own system. Although building your own system will probably take longer. 

Let me know if you have any specific questions about the implementation. 

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com
Attachments:

db_example.png 8K