POST checkbox



  • How do you get the value through POST on the flags?

    For example

         <input type="checkbox" name="Антон" value="a1" checked>Антон<br>
         <input type="checkbox" name="Максим" value="a2"> Максим<br>
         <input type="checkbox" name="Игорь" value="a3"> Игорь<br> 
         <input type="checkbox" name="Аркадий" value="a4"> Аркадий<br> 
         <input type="submit" value="Выбрать"></p>
    

    Well, how do you get the meaning for every version of it?

            $name = $_POST['Антон'];
             $name = $_POST['Максим'];
            $name = $_POST['Игорь'];
    

    What's going to be in the $name?



  • I understand that you called checkbox.

    Obtaining the value, like any other field, is nothing different.

    P.S. We need to make different names.

    UPD:

     <input type="checkbox" name="name[]" value="Антон" checked>Антон<br>
     <input type="checkbox" name="name[]" value="Максим"> Максим<br>
     <input type="checkbox" name="name[]" value="Игорь"> Игорь<br> 
     <input type="checkbox" name="name[]" value="Аркадий"> Аркадий<br>
    

    Here's what you get:

    print_r( $_POST['name'] );
    

    Specific implementation depends on what you need. ♪ ♪


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2