Form: Accessing values of array of checkboxes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kay Molkenthin

    #1

    Form: Accessing values of array of checkboxes

    Hello,

    I have a form with a dynamic checkbox structure:

    for ($ix=1; $ix<=$anzahl; $ix++)
    {
    echo "<TR><TD align=right>$ix .</TD><TD ALIGN=\"center\ ">";
    echo "<input type=\"radio\" name=\"partei[$ix]\" value=\"Sel1\"> </TD><TD
    align=\"center\ ">";
    echo "<input type=\"radio\" name=\"partei[$ix]\" value=\"Sel2\"> </TD>";
    }

    At least at the screen everything works as was supposed to do.

    I send the form with POST.

    How do I access the array to work with the state of the checkboxes?

    My tries with ($ix=loop count)

    echo $_POST['partei[$ix]'];

    oder

    echo $_POST[$partei[$ix]];

    don't give me a value back.

    Thanks Kay
  • Matthias Esken

    #2
    Re: Form: Accessing values of array of checkboxes

    Kay Molkenthin schrieb:
    [color=blue]
    > How do I access the array to work with the state of the checkboxes?[/color]

    Might I suggest the german FAQ?

    11.10. Wie kann man Checkboxen verarbeiten?


    Regards,
    Matthias

    Comment

    • Marian Heddesheimer

      #3
      Re: Form: Accessing values of array of checkboxes

      On Sat, 12 Jun 2004 22:34:56 +0200, Kay Molkenthin
      <Kay.Molkenthin @e-realm.de> wrote:
      [color=blue]
      >My tries with ($ix=loop count)
      >
      >echo $_POST['partei[$ix]'];[/color]

      try echo $_POST['partei'][$ix];

      Greetings

      Marian

      --
      Tipps und Tricks zu PHP, Coaching und Projektbetreuun g
      http://www.heddesheimer.de/coaching/

      Comment

      • PhilM

        #4
        Re: Accessing values of array of checkboxes


        "Kay Molkenthin" <Kay.Molkenthin @e-realm.de> wrote in message
        news:opr9h0siem 6o4z16@news.cis .dfn.de...[color=blue]
        > Hello,
        >
        > I have a form with a dynamic checkbox structure:
        >
        > for ($ix=1; $ix<=$anzahl; $ix++)
        > {
        > echo "<TR><TD align=right>$ix .</TD><TD ALIGN=\"center\ ">";
        > echo "<input type=\"radio\" name=\"partei[$ix]\" value=\"Sel1\"> </TD><TD
        > align=\"center\ ">";
        > echo "<input type=\"radio\" name=\"partei[$ix]\" value=\"Sel2\"> </TD>";
        > }[/color]

        I may have missed something here, BUT, you are using radio buttons in this
        form not checkboxes.
        May cause you probs :)

        PhilM


        Comment

        Working...