SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Aug 2006
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    using dynamic checkbox name in code

    Hello,

    I've inherited code which name dynamically created checkbox
    <input type='checkbox' name='selectedID[22]' />

    with the number '22' changing based on id.

    I've tried using the checkbox name in code as in

    Code:
    if (isset($_POST['sprintf("selectedID[%s]", $id)']))
    or
    Code:
    if (isset($_POST['selectedID[' . %s . ']', $id)']))
    even hardcoding it as
    Code:
    if (isset($_POST['selectedID[22]']))
    but all the if statements evaluate to false. How do I get to use the checkbox name in code?

    thanks

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $_POST['selectedID'][22]

  3. #3
    SitePoint Zealot
    Join Date
    Aug 2006
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks, worked perfectly


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
  •