SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2006
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    fetch multiple checkbox with javascript and pass to php for processing

    hi,
    I hava javascript code
    PHP Code:
      <div class="pages-in-30"><input type="checkbox" name="c0" onclick="checkAll(this)" /></div
    to check multiple records for some bulk actions (delete, active, inactive and so on). But how can I sent this checked records to php for further processing.

  2. #2
    I solve practical problems. bronze trophy
    Michael Morris's Avatar
    Join Date
    Jan 2008
    Location
    Knoxville TN
    Posts
    2,011
    Mentioned
    56 Post(s)
    Tagged
    0 Thread(s)
    Input elements can be arrays. For example

    HTML Code:
    <input type="checkbox" name="myList[firstoption]" value="1">
    <input type="checkbox" name="myList[secondoption]" value="1">
    <input type="checkbox" name="myList[thirdoption]" value="1">
    <input type="checkbox" name="myList[forthoption]" value="1">
    will be received by PHP as

    PHP Code:
    echo $_POST['myList']['firstoption']; // The first checkbox's value if it was checked. 
    If a checkbox isn't checked it's corresponding array element will not be set in the $_POST array.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •