• waywrd180

    (@waywrd180)


    Hi there WP Community,

    I am looking at creating a simple form for my darts teams to enter their results.

    I am struggling with finding how to link ‘drop down list’ for teams or players that link directly with the players or teams loaded into my WP DB?

    Anyone done this before and can give any guidance?

    Thanks
    Justin

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    It’s not clear to me how your “‘drop down list’ for teams or players” would relate to WP users. You can get a dropdown list of WP users with the function wp_dropdown_users(). If your WP users are not themselves teams or players, you would need to include data that relates WP users to teams. If your goal is to list teams and there are multiple users on the same team, you would get redundant team listings unless the output is filtered to remove redundancies.

    You could instead have “users” that are the teams themselves, regardless of whether there are also player users on the team or not. If the team “users” are assigned a specific role, it’s trivial to get the wp_dropdown_users() function to only list “users” of that particular role.

    You would generally relate WP users to other data by their respective User IDs. This is how the usermeta table is joined to the users table when writing SQL queries. Similarly how authors are related to their posts.

Viewing 1 replies (of 1 total)
  • The topic ‘Result Form to link to WP DB’ is closed to new replies.