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 8938235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:34:47+00:00 2026-06-15T10:34:47+00:00

I have a form that has checkboxes on it. Each check box is assigned

  • 0

I have a form that has checkboxes on it. Each check box is assigned a value from 1 to 10. These values correspond to an ID in a table for service names. Here is the form checkbox markup:

<input type="checkbox" name="serv[]" id="janitorial" value=1><label for="janitorial" class="radCheck">Full Service Janitorial</label>
<input type="checkbox" name="serv[]" id="strip" value=6><label for="strip" class="radCheck">Stripping & Waxing</label></br>
<input type="checkbox" name="serv[]" id="buff" value=2><label for="buff" class="radCheck">Floor Buffing/Burnishing</label>
<input type="checkbox" name="serv[]" id="carp" value=7><label for="carp" class="radCheck">Carpet & Upholstery Care</label><br>
<input type="checkbox" name="serv[]" id="tile" value=3><label for="tile" class="radCheck">Tile Cleaning & Restoration</label>
<input type="checkbox" name="serv[]" id="windows" value=8><label for="windows"class="radCheck">Window & Blind Care</label></br>
<input type="checkbox" name="serv[]" id="park" value=4><label for="park" class="radCheck">Parking Lot Care</label>
<input type="checkbox" name="serv[]" id="porter" value=9><label for="porter" class="radCheck">Day Porter</label></br>
<input type="checkbox" name="serv[]" id="snow" value=5><label for="snow" class="radCheck">Snow Removal & Landscape</label>
<input type="checkbox" name="serv[]" id="rest" value=10><label for="rest" class="radCheck">Restroom Services & Supplies</label>

This is posted with all the other form data and sent in an email as well as inputted into the database. I am try to retrieve the names of each service selected from the database but cannot figure out how to write the results of my query. Here is the code for the services query:

$conn=connect();

            $names = implode(',', $serv);
            $query = "SELECT SERVICE_NAME FROM SERVICES WHERE SERVICE_ID ({$names})";
            $result = mysql_query($query);                

            echo "$query";

This outputs:

SELECT SERVICE_NAME FROM SERVICES WHERE SERVICE_ID (1,7,3)

When I submitted the form I had boxes 1, 7, and 3 checked. This all seems right to me. But when I try to get the results through fetch_array or fetch_row I get errors. I’ve tried countless loops and as many suggestions as I could find on here and other sites. How can I write the results of the query? Please go easy on me, I am very new to PHP and am sure I’m missing something simple.

  • 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-06-15T10:34:48+00:00Added an answer on June 15, 2026 at 10:34 am

    That’s incorrect:

    SELECT SERVICE_NAME FROM SERVICES WHERE SERVICE_ID IN (1,7,3)
                                                      ^^^^---missing
    

    And please note that you’re wide open to an sql injection attack. Enjoy having your server pwn3d. You also seem to be depending on register_globals being enabled (unless you’re doing stuff in code not shown here). Definitely step away from this code, update your PHP version, and LEARN how to write secure code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form that has some textboxes (45) with CheckBoxes next to each,
I have a form that has a group of 13 checkboxes that together make
I have a workbook that has many checkboxes (form control) on one tab. I
I have a form that has a series of check boxes and some line
I have a form that has label values that I would like to pass
I have a form that has 90 buttons on it, one button for each
I have a form that has many checkboxes (too many for it to make
I have a table that has checkboxes, if a checkbox is selected i want
I have a form that has a group of 3 text_fields. I need two
I have a form that has many long-methods. My quest is: What is the

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.