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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T19:28:14+00:00 2026-05-14T19:28:14+00:00

I have such select list in html: <input type=checkbox name=drive_style value=1 checked />123<br />

  • 0

I have such select list in html:

<input type="checkbox" name="drive_style" value=1 checked />123<br />
<input type="checkbox" name="drive_style" value=2 />123<br />
<input type="checkbox" name="drive_style" value=3 checked /> 123<br />
<input type="checkbox" name="drive_style" value=4 />123<br />
<input type="checkbox" name="drive_style" value=5 checked />123<br />

I have to send values(1, 3, …) of checked boxes to the php script (I’m using ajax with jquery) like an array. Something like: drive_style[index].

    $.post('post_reply.php', {'drive_style'  : $('drive_style')}, function(data){
        alert(data);
    });

In PHP script:

print_r($_POST['drive_style']);

[object Object]


upd:
My new code:

<input type="checkbox" name="drive_style[]" value=1 checked />123<br />
<input type="checkbox" name="drive_style[]" value=2 />123<br />
<input type="checkbox" name="drive_style[]" value=3 checked />123<br />
<input type="checkbox" name="drive_style[]" value=4 />123<br />
<input type="checkbox" name="drive_style[]" value=5 checked />123<br />

    $.post('post_reply.php', {'drive_style':$('input[name=drive_style]').serialize()}, function(data){
        alert(data);
    });

It alerts empty string.

  • 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-14T19:28:14+00:00Added an answer on May 14, 2026 at 7:28 pm
    ​$(function() {
    var serial = $('input[name=drive_style]').serialize();
    //php -> $('input[name=drive_style[]]').serialize();
      alert( serial );
    });​
    

    this give you:

    drive_style=1&drive_style=3&drive_style=5
    

    but for work with php you also need to have input name like this:

    <input type="checkbox" name="drive_style[]" value=1 checked />123<br />
    

    NOTE: drive_style[]

    that obviously giv you:

    drive_style[]=1&drive_style[]=3&drive_style[]=5
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 489k
  • Answers 489k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Not a single - is mandatory. You can have any… May 16, 2026 at 8:59 am
  • Editorial Team
    Editorial Team added an answer The real issue here is: what's your standard for naming… May 16, 2026 at 8:59 am
  • Editorial Team
    Editorial Team added an answer Although defining the buffer size with a #define is one… May 16, 2026 at 8:59 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a simple html form. On php page. A simple list is placed
I have a UserForm class which has a select list populated from a related
Using the example at the following URL: http://www.kavoir.com/2009/02/php-drop-down-list.html How can I have that drop
I have a wizard-style HTML form with a row of submit buttons for the
I would like to create a DropDownList containing 2 items: Part Name and NSN
Excuse my lack of html knowledge, but is it possible to set up a
I have an array of strings, called @theModels, in a routine implemented as part
I am working in the confines of a CMS system, which defines certain fields
Nice to meet you. I developed Windows application with VisualStudio so far. It was

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.