Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6475093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:39:52+00:00 2026-05-25T06:39:52+00:00

When my user searches for game in my DB, I present them with a

  • 0

When my user searches for game in my DB, I present them with a list of the games that match their search term, and then i want to add a button to each item that allows the user to select “have it” or “want it” then have a single “add” button that adds their selections to their profile.

because you cant have it and want it at the same time, i assumed a radio button would be the best choice.

but now i am lost as to how to handle the buttons. When i click on one selection from the search, it will deselect when i choose have or want on another game.

I understand that i should be creating a separately name form for each search result, but then how would i manage the data when sending it to my controller? Maybe i need incrementing form names and then count how many results and use that in my controller?

Also, i need the gameID associated with the selections so i need to send a hidden value with that data for each selection

maybe i am going about this the wrong way…

heres my code

echo '<div id="UserSearchGameResults">';
            echo '<form action="#" method="Post">';
            $x = 0;
            while($gamesLike != null)
            {
                $x++;

                echo '<div id="game_search_list_item">'.$x.'. '.$gamesLike['title'].'</div>

                <span class="gamelistblue">
                    <input type="radio" name="haveOrWant" value="have" />Have it
                </span>

                <span class="gamelistorange">
                    <input type="radio" name="haveOrWant" value="want" />Want it
                </span>

                <input type="hidden" name="gameID" value="'.$gamesLike['ID'].'" />';

                $gamesLike = $statement->fetch();
            }
            $statement->closeCursor();

            echo '<br /> <input type="submit" value="Add Game(s)" />';

            echo '</div></form>';   

any help is appreciated with the subject

new ideas on how to handle my needs are welcome too.

Dan

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:39:52+00:00Added an answer on May 25, 2026 at 6:39 am

    Use arrays for the input names. Something like

    <input type="radio" name="game' . $gamesLike['ID'] . '[haveOrWant]" value="have" />Have it
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble highlighting a search term within a query. If a user searches
I am providing search functionality in my website, when user searches a record then
This is a web app that works when user searches for an item to
User is a model. I have 100 users. I need to present the list
When a user searches and selects one of the departments it must take them
I've got a client who's asking if their search, which searches for company names
I have a jQuery search script that uses tabs for the user to define
I have a search field and button. When the user searches something like cat
Use: The user searches for a partial postcode such as 'RG20' which should then
I have a jQuery search script that uses tabs for the user to define

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.