Getting checkbox values on submit












46















I have 6 options, I want to get the checked values to store them in variable on second page. How do I go on doing that?



<form action="third.php" method="get">
<!-- Choices -->
Red <input type="checkbox" name="color" id="color" value="Red">
Green <input type="checkbox" name="color" id="color" value="Green">
Blue <input type="checkbox" name="color" id="color" value="Blue">
Cyan <input type="checkbox" name="color" id="color" value="Cyan">
Magenta <input type="checkbox" name="color" id="color" value="Magenta">
Yellow <input type="checkbox" name="color" id="color" value="Yellow">
Black <input type="checkbox" name="color" id="color" value="Black">
<!-- Submit -->
<input type="submit" value="submit">
</form>


And third.php page :



$color = $_GET['color'];

echo 'The color is '.$color;


If I remove , I get the color is on, when I do it like color I get a notice saying :




Array to string conversion




What I want is the value of checked, checkboxes so I can store it in variable.










share|improve this question




















  • 1





    @blo i edited it.

    – Nofel
    Aug 24 '13 at 19:21






  • 1





    @MadaraUchiha thank you, i edited the question.

    – Nofel
    Aug 24 '13 at 19:22






  • 2





    Its not action="get" its method="get" !

    – Rahul
    Aug 24 '13 at 19:48






  • 1





    @AmmarKhan Have a look at my answer below, with a few additional options you can use.

    – Funk Forty Niner
    Aug 24 '13 at 23:59






  • 1





    I would suggest to use post method instead of get for form submit.

    – Naina
    Mar 17 '14 at 8:10
















46















I have 6 options, I want to get the checked values to store them in variable on second page. How do I go on doing that?



<form action="third.php" method="get">
<!-- Choices -->
Red <input type="checkbox" name="color" id="color" value="Red">
Green <input type="checkbox" name="color" id="color" value="Green">
Blue <input type="checkbox" name="color" id="color" value="Blue">
Cyan <input type="checkbox" name="color" id="color" value="Cyan">
Magenta <input type="checkbox" name="color" id="color" value="Magenta">
Yellow <input type="checkbox" name="color" id="color" value="Yellow">
Black <input type="checkbox" name="color" id="color" value="Black">
<!-- Submit -->
<input type="submit" value="submit">
</form>


And third.php page :



$color = $_GET['color'];

echo 'The color is '.$color;


If I remove , I get the color is on, when I do it like color I get a notice saying :




Array to string conversion




What I want is the value of checked, checkboxes so I can store it in variable.










share|improve this question




















  • 1





    @blo i edited it.

    – Nofel
    Aug 24 '13 at 19:21






  • 1





    @MadaraUchiha thank you, i edited the question.

    – Nofel
    Aug 24 '13 at 19:22






  • 2





    Its not action="get" its method="get" !

    – Rahul
    Aug 24 '13 at 19:48






  • 1





    @AmmarKhan Have a look at my answer below, with a few additional options you can use.

    – Funk Forty Niner
    Aug 24 '13 at 23:59






  • 1





    I would suggest to use post method instead of get for form submit.

    – Naina
    Mar 17 '14 at 8:10














46












46








46


26






I have 6 options, I want to get the checked values to store them in variable on second page. How do I go on doing that?



<form action="third.php" method="get">
<!-- Choices -->
Red <input type="checkbox" name="color" id="color" value="Red">
Green <input type="checkbox" name="color" id="color" value="Green">
Blue <input type="checkbox" name="color" id="color" value="Blue">
Cyan <input type="checkbox" name="color" id="color" value="Cyan">
Magenta <input type="checkbox" name="color" id="color" value="Magenta">
Yellow <input type="checkbox" name="color" id="color" value="Yellow">
Black <input type="checkbox" name="color" id="color" value="Black">
<!-- Submit -->
<input type="submit" value="submit">
</form>


And third.php page :



$color = $_GET['color'];

echo 'The color is '.$color;


If I remove , I get the color is on, when I do it like color I get a notice saying :




Array to string conversion




What I want is the value of checked, checkboxes so I can store it in variable.










share|improve this question
















I have 6 options, I want to get the checked values to store them in variable on second page. How do I go on doing that?



<form action="third.php" method="get">
<!-- Choices -->
Red <input type="checkbox" name="color" id="color" value="Red">
Green <input type="checkbox" name="color" id="color" value="Green">
Blue <input type="checkbox" name="color" id="color" value="Blue">
Cyan <input type="checkbox" name="color" id="color" value="Cyan">
Magenta <input type="checkbox" name="color" id="color" value="Magenta">
Yellow <input type="checkbox" name="color" id="color" value="Yellow">
Black <input type="checkbox" name="color" id="color" value="Black">
<!-- Submit -->
<input type="submit" value="submit">
</form>


And third.php page :



$color = $_GET['color'];

echo 'The color is '.$color;


If I remove , I get the color is on, when I do it like color I get a notice saying :




Array to string conversion




What I want is the value of checked, checkboxes so I can store it in variable.







php forms






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 1 '14 at 10:02







Nofel

















asked Aug 24 '13 at 18:53









NofelNofel

5361830




5361830








  • 1





    @blo i edited it.

    – Nofel
    Aug 24 '13 at 19:21






  • 1





    @MadaraUchiha thank you, i edited the question.

    – Nofel
    Aug 24 '13 at 19:22






  • 2





    Its not action="get" its method="get" !

    – Rahul
    Aug 24 '13 at 19:48






  • 1





    @AmmarKhan Have a look at my answer below, with a few additional options you can use.

    – Funk Forty Niner
    Aug 24 '13 at 23:59






  • 1





    I would suggest to use post method instead of get for form submit.

    – Naina
    Mar 17 '14 at 8:10














  • 1





    @blo i edited it.

    – Nofel
    Aug 24 '13 at 19:21






  • 1





    @MadaraUchiha thank you, i edited the question.

    – Nofel
    Aug 24 '13 at 19:22






  • 2





    Its not action="get" its method="get" !

    – Rahul
    Aug 24 '13 at 19:48






  • 1





    @AmmarKhan Have a look at my answer below, with a few additional options you can use.

    – Funk Forty Niner
    Aug 24 '13 at 23:59






  • 1





    I would suggest to use post method instead of get for form submit.

    – Naina
    Mar 17 '14 at 8:10








1




1





@blo i edited it.

– Nofel
Aug 24 '13 at 19:21





@blo i edited it.

– Nofel
Aug 24 '13 at 19:21




1




1





@MadaraUchiha thank you, i edited the question.

– Nofel
Aug 24 '13 at 19:22





@MadaraUchiha thank you, i edited the question.

– Nofel
Aug 24 '13 at 19:22




2




2





Its not action="get" its method="get" !

– Rahul
Aug 24 '13 at 19:48





Its not action="get" its method="get" !

– Rahul
Aug 24 '13 at 19:48




1




1





@AmmarKhan Have a look at my answer below, with a few additional options you can use.

– Funk Forty Niner
Aug 24 '13 at 23:59





@AmmarKhan Have a look at my answer below, with a few additional options you can use.

– Funk Forty Niner
Aug 24 '13 at 23:59




1




1





I would suggest to use post method instead of get for form submit.

– Naina
Mar 17 '14 at 8:10





I would suggest to use post method instead of get for form submit.

– Naina
Mar 17 '14 at 8:10












10 Answers
10






active

oldest

votes


















114














A good method which is a favorite of mine and for many I'm sure, is to make use of foreach which will output each color you chose, and appear on screen one underneath each other.



When it comes to using checkboxes, you kind of do not have a choice but to use foreach, and that's why you only get one value returned from your array.



Here is an example using $_GET. You can however use $_POST and would need to make both directives match in both files in order to work properly.



HTML FORM



<form action="third.php" method="get">
Red<input type="checkbox" name="color" id="color" value="red">
Green<input type="checkbox" name="color" id="color" value="green">
Blue<input type="checkbox" name="color" id="color" value="blue">
Cyan<input type="checkbox" name="color" id="color" value="cyan">
Magenta<input type="checkbox" name="color" id="color" value="Magenta">
Yellow<input type="checkbox" name="color" id="color" value="yellow">
Black<input type="checkbox" name="color" id="color" value="black">
<input type="submit" value="submit">
</form>


PHP (using $_GET) using third.php as your handler



<?php

$name = $_GET['color'];

// optional
// echo "You chose the following color(s): <br>";

foreach ($name as $color){
echo $color."<br />";
}

?>


Assuming having chosen red, green, blue and cyan as colors, will appear like this:



red

green

blue

cyan





OPTION #2



You can also check if a color was chosen. If none are chosen, then a seperate message will appear.



<?php

$name = $_GET['color'];

if (isset($_GET['color'])) {
echo "You chose the following color(s): <br>";

foreach ($name as $color){
echo $color."<br />";
}
} else {
echo "You did not choose a color.";
}

?>




Additional options:



To appear as a list: (<ul></ul> can be replaced by <ol></ol>)



<?php

$name = $_GET['color'];

if (isset($_GET['color'])) {
echo "You chose the following color(s): <br>";
echo "<ul>";
foreach ($name as $color){
echo "<li>" .$color."</li>";
}
echo "</ul>";
} else {
echo "You did not choose a color.";
}

?>




Flag: (August the 5th, 2016)



I've received 2 downvotes this morning and my comments we're removed; why? Whoever's doing this, is obvioulsy doing this with malice. The answer has received nothing but upvotes and now this. I mean seriously; wtf? – Fred -ii- 1 hour ago declined - People are free to vote how they want, as long as you're not being targeted. I see no evidence of that. Your comments about votes were noise, flagged as such, and removed.



Answer to this: That's just the thing; I am.






share|improve this answer





















  • 5





    whoever just dv this, also dv another of my answers stackoverflow.com/a/18382062/1415724 obviously someone coming from answers in this question stackoverflow.com/q/43875382/1415724 I am sure of it. If they can't take the downvote for what should have been a comment, then they shouldn't post at all; IMHO. Downvote me if you want, I don't care, but "you" lose points in doing that, remember that.

    – Funk Forty Niner
    May 9 '17 at 16:54





















13














(It's not action="get" or action="post" it's method="get" or method="post"



Try to do it using post method:



<form action="third.php" method="POST">
Red<input type="checkbox" name="color" id="color" value="red">
Green<input type="checkbox" name="color" id="color" value="green">
Blue<input type="checkbox" name="color" id="color" value="blue">
Cyan<input type="checkbox" name="color" id="color" value="cyan">
Magenta<input type="checkbox" name="color" id="color" value="Magenta">
Yellow<input type="checkbox" name="color" id="color" value="yellow">
Black<input type="checkbox" name="color" id="color" value="black">
<input type="submit" value="submit">
</form>


and in third.php



or for a pericular field you colud get value in:



$_POST['color'][0] //for RED
$_POST['color'][1] // for GREEN





share|improve this answer


























  • Ahh, so this is when things start to get wonky with PHP. $_POST is an array, and when looking at the solutions, I wondered, "$_POST['color'] is also it's own array, too, isn't it?"

    – DeltaFlyer
    Nov 30 '18 at 20:07





















9














What i suggest is , its better to use post than get. here are some difference between post VS get



Some notes on GET requests:




  1. GET requests can be cached

  2. GET requests remain in the browser history

  3. GET requests can be bookmarked

  4. GET requests should never be used when dealing with sensitive data

  5. GET requests have length restrictions

  6. GET requests should be used only to retrieve data


Some notes on POST requests:




  1. POST requests are never cached

  2. POST requests do not remain in the browser history

  3. POST requests cannot be bookmarked

  4. POST requests have no restrictions on data length


HTML Code



            <html>
<head></head>
<body>
<form action="output.php" method="post">
Red<input type="checkbox" name="color" id="color" value="red">
Green<input type="checkbox" name="color" id="color" value="green">
Blue<input type="checkbox" name="color" id="color" value="blue">
Cyan<input type="checkbox" name="color" id="color" value="cyan">
Magenta<input type="checkbox" name="color" id="color" value="Magenta">
Yellow<input type="checkbox" name="color" id="color" value="yellow">
Black<input type="checkbox" name="color" id="color" value="black">
<input type="submit" value="submit">
</form>
<body>
</html>


PHP code



    <?php


if(isset($_POST['color'])) {
$name = $_POST['color'];

echo "You chose the following color(s): <br>";
foreach ($name as $color){
echo $color."<br />";
}} // end brace for if(isset

else {

echo "You did not choose a color.";

}

?>





share|improve this answer


























  • What's about 2-dimension arrays? Does GET support something like this: <input type="checkbox" name="color[categoryA]" id="color" value="red"> <input type="checkbox" name="color[categoryA]" id="color" value="green"> which will work with mehtod=POST

    – The Bndr
    Apr 24 '18 at 11:56





















0














Just for printing you can use as below :



print_r($_GET['color']);


or



var_dump($_GET['color']);





share|improve this answer































    0














    I think the value for the $_POST['color'] should be read only after checking if its set.



    <?php


    if(isset($_POST['color'])) {
    $name = $_POST['color'];

    echo "You chose the following color(s): <br>";
    foreach ($name as $color){
    echo $color."<br />";
    }} // end brace for if(isset

    else {

    echo "You did not choose a color.";

    }

    ?>





    share|improve this answer

































      0














      Perhaps a better way is using the php function in_array() like this:



      $style='V';//can be 'V'ertical or 'H'orizontal
      $lineBreak=($style=='V')?'<br>':'';
      $name='colors';//the name of your options
      $Legent="Select your $name";//dress it up in a nice fieldset with a ledgent
      $options=array('red','green','blue','orange','yellow','white','black');
      $boxes='';//innitiate the list of tickboxes to be generated
      if(isset($_REQUEST["$name"])){
      //we shall use $_REQUEST but $_POST would be better
      $Checked=$_REQUEST["$name"];
      }else{
      $Checked=array();
      }
      foreach($options as $option){
      $checkmark=(in_array($option,$Checked))?'checked':'';
      $nameAsArray=$name.'';//we would like the returned data to be in an array so we end with
      $boxes.=($style=='V')?"<span class='label2' align='right'><b>$option : </b></span>":"<b>$option </b>";
      $boxes.="<input style='width:2em;' type='checkbox' name='$nameAsArray' id='$option' value='$option' $checkmark >$lineBreak";
      }

      echo<<<EOF
      <html>
      <head></head>
      <body>
      <form name="Update" method="GET" action="{$_SERVER['PHP_SELF']}">n
      <fieldset id="tickboxes" style="width:25em;">
      <legend>{$Legent}</legend>
      {$boxes}
      </fieldset>
      <button type="submit" >Submit Form</button>
      </form>
      <body>
      </html>
      EOF
      ;


      To start with we have created a variable $style to set if we want the options in a horizontal or vertical way. This will infrequence how we display our checkboxes. Next we set the $name for our options, this is needed as a name of the array where we want to keep our options.
      I have created a loop here to construct each option as given in the array $options, then we check each item if it should be checked in our returned form. I believe this should simplify the way we can reproduce a form with checkboxes.






      share|improve this answer































        0














        If you want to turn specific values in to new variables if they have been selected:



        // Retrieve array color and set as variable    
        $colors = $_GET['color'];
        // Use array_search to find the key for "red"
        $key_red = array_search('red', $colors);
        // If "red" exists, the key will be an integer (or FALSE)
        if (is_int($key_red)) {
        $red_color = 'Red was selected';
        }





        share|improve this answer

































          0














          foreach is the best way to get array of values.



          here the example code:
          html code:



          <form action="send.php" method="post">
          Red<input type="checkbox" name="color" id="color" value="red">
          Green<input type="checkbox" name="color" id="color" value="green">
          Blue<input type="checkbox" name="color" id="color" value="blue">
          Cyan<input type="checkbox" name="color" id="color" value="cyan">
          Magenta<input type="checkbox" name="color" id="color" value="Magenta">
          Yellow<input type="checkbox" name="color" id="color" value="yellow">
          Black<input type="checkbox" name="color" id="color" value="black">
          <input type="submit" value="submit">
          </form>


          phpcode:



          <?php

          $name = $POST['color'];



          foreach ($name as $color){
          echo $color."<br />";
          }

          ?>





          share|improve this answer
























          • cool answer !! it works

            – anonymouse
            Jun 19 '18 at 5:34



















          0














          It's very simple.



          The checkbox field is like an input text. If you don't write anything in the field, it will say the field doesn't exist.



          <form method="post">
          <input type="checkbox" name="check">This is how it works!<br>
          <button type="submit" name="submit">Submit</button>
          </form>
          <?php
          if(isset($_POST['submit'])) {
          if(!isset($_POST['check'])) {
          echo "Not selected!";
          }else{
          echo "Selected!";
          }
          }
          ?>





          share|improve this answer

































            -1














            //retrive check box and gender value
            $gender=$row['gender'];
            $chkhobby=$row['chkhobby'];
            <tr>
            <th>GENDER</th>
            <td>
            Male<input type="radio" name="gender" value="1" <?php echo ($gender== '1') ? "checked" : "" ; ?>/>
            Female<input type="radio" name="gender" value="0" <?php echo ($gender== '0') ? "checked" : "" ; ?>/>

            </td>
            </tr>
            <tr>
            <th>Hobbies</th>
            <td>
            <pre><?php //print_r($row);

            $hby = @explode(",",$row['chkhobby']);
            //print_r($hby);
            ?></pre>
            read<input id="check_1" type="checkbox" name="chkhobby" value="read" <?php if(in_array("read",$hby)){?> checked="checked"<?php }?>>
            write<input id="check_2" type="checkbox" name="chkhobby" value="write" <?php if(in_array("write",$hby)){?> checked="checked"<?php }?>>
            play<input id="check_4" type="checkbox" name="chkhobby" value="play" <?php if(in_array("play",$hby)){?> checked="checked"<?php }?>>


            </td>
            </tr>
            //update
            $gender=$_POST['gender'];
            $chkhobby = implode(',', $_POST['chkhobby']);





            share|improve this answer





















            • 1





              Please don't paste row code without explanation.

              – Al Foиce ѫ
              Aug 11 '16 at 9:11











            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f18421988%2fgetting-checkbox-values-on-submit%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            10 Answers
            10






            active

            oldest

            votes








            10 Answers
            10






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            114














            A good method which is a favorite of mine and for many I'm sure, is to make use of foreach which will output each color you chose, and appear on screen one underneath each other.



            When it comes to using checkboxes, you kind of do not have a choice but to use foreach, and that's why you only get one value returned from your array.



            Here is an example using $_GET. You can however use $_POST and would need to make both directives match in both files in order to work properly.



            HTML FORM



            <form action="third.php" method="get">
            Red<input type="checkbox" name="color" id="color" value="red">
            Green<input type="checkbox" name="color" id="color" value="green">
            Blue<input type="checkbox" name="color" id="color" value="blue">
            Cyan<input type="checkbox" name="color" id="color" value="cyan">
            Magenta<input type="checkbox" name="color" id="color" value="Magenta">
            Yellow<input type="checkbox" name="color" id="color" value="yellow">
            Black<input type="checkbox" name="color" id="color" value="black">
            <input type="submit" value="submit">
            </form>


            PHP (using $_GET) using third.php as your handler



            <?php

            $name = $_GET['color'];

            // optional
            // echo "You chose the following color(s): <br>";

            foreach ($name as $color){
            echo $color."<br />";
            }

            ?>


            Assuming having chosen red, green, blue and cyan as colors, will appear like this:



            red

            green

            blue

            cyan





            OPTION #2



            You can also check if a color was chosen. If none are chosen, then a seperate message will appear.



            <?php

            $name = $_GET['color'];

            if (isset($_GET['color'])) {
            echo "You chose the following color(s): <br>";

            foreach ($name as $color){
            echo $color."<br />";
            }
            } else {
            echo "You did not choose a color.";
            }

            ?>




            Additional options:



            To appear as a list: (<ul></ul> can be replaced by <ol></ol>)



            <?php

            $name = $_GET['color'];

            if (isset($_GET['color'])) {
            echo "You chose the following color(s): <br>";
            echo "<ul>";
            foreach ($name as $color){
            echo "<li>" .$color."</li>";
            }
            echo "</ul>";
            } else {
            echo "You did not choose a color.";
            }

            ?>




            Flag: (August the 5th, 2016)



            I've received 2 downvotes this morning and my comments we're removed; why? Whoever's doing this, is obvioulsy doing this with malice. The answer has received nothing but upvotes and now this. I mean seriously; wtf? – Fred -ii- 1 hour ago declined - People are free to vote how they want, as long as you're not being targeted. I see no evidence of that. Your comments about votes were noise, flagged as such, and removed.



            Answer to this: That's just the thing; I am.






            share|improve this answer





















            • 5





              whoever just dv this, also dv another of my answers stackoverflow.com/a/18382062/1415724 obviously someone coming from answers in this question stackoverflow.com/q/43875382/1415724 I am sure of it. If they can't take the downvote for what should have been a comment, then they shouldn't post at all; IMHO. Downvote me if you want, I don't care, but "you" lose points in doing that, remember that.

              – Funk Forty Niner
              May 9 '17 at 16:54


















            114














            A good method which is a favorite of mine and for many I'm sure, is to make use of foreach which will output each color you chose, and appear on screen one underneath each other.



            When it comes to using checkboxes, you kind of do not have a choice but to use foreach, and that's why you only get one value returned from your array.



            Here is an example using $_GET. You can however use $_POST and would need to make both directives match in both files in order to work properly.



            HTML FORM



            <form action="third.php" method="get">
            Red<input type="checkbox" name="color" id="color" value="red">
            Green<input type="checkbox" name="color" id="color" value="green">
            Blue<input type="checkbox" name="color" id="color" value="blue">
            Cyan<input type="checkbox" name="color" id="color" value="cyan">
            Magenta<input type="checkbox" name="color" id="color" value="Magenta">
            Yellow<input type="checkbox" name="color" id="color" value="yellow">
            Black<input type="checkbox" name="color" id="color" value="black">
            <input type="submit" value="submit">
            </form>


            PHP (using $_GET) using third.php as your handler



            <?php

            $name = $_GET['color'];

            // optional
            // echo "You chose the following color(s): <br>";

            foreach ($name as $color){
            echo $color."<br />";
            }

            ?>


            Assuming having chosen red, green, blue and cyan as colors, will appear like this:



            red

            green

            blue

            cyan





            OPTION #2



            You can also check if a color was chosen. If none are chosen, then a seperate message will appear.



            <?php

            $name = $_GET['color'];

            if (isset($_GET['color'])) {
            echo "You chose the following color(s): <br>";

            foreach ($name as $color){
            echo $color."<br />";
            }
            } else {
            echo "You did not choose a color.";
            }

            ?>




            Additional options:



            To appear as a list: (<ul></ul> can be replaced by <ol></ol>)



            <?php

            $name = $_GET['color'];

            if (isset($_GET['color'])) {
            echo "You chose the following color(s): <br>";
            echo "<ul>";
            foreach ($name as $color){
            echo "<li>" .$color."</li>";
            }
            echo "</ul>";
            } else {
            echo "You did not choose a color.";
            }

            ?>




            Flag: (August the 5th, 2016)



            I've received 2 downvotes this morning and my comments we're removed; why? Whoever's doing this, is obvioulsy doing this with malice. The answer has received nothing but upvotes and now this. I mean seriously; wtf? – Fred -ii- 1 hour ago declined - People are free to vote how they want, as long as you're not being targeted. I see no evidence of that. Your comments about votes were noise, flagged as such, and removed.



            Answer to this: That's just the thing; I am.






            share|improve this answer





















            • 5





              whoever just dv this, also dv another of my answers stackoverflow.com/a/18382062/1415724 obviously someone coming from answers in this question stackoverflow.com/q/43875382/1415724 I am sure of it. If they can't take the downvote for what should have been a comment, then they shouldn't post at all; IMHO. Downvote me if you want, I don't care, but "you" lose points in doing that, remember that.

              – Funk Forty Niner
              May 9 '17 at 16:54
















            114












            114








            114







            A good method which is a favorite of mine and for many I'm sure, is to make use of foreach which will output each color you chose, and appear on screen one underneath each other.



            When it comes to using checkboxes, you kind of do not have a choice but to use foreach, and that's why you only get one value returned from your array.



            Here is an example using $_GET. You can however use $_POST and would need to make both directives match in both files in order to work properly.



            HTML FORM



            <form action="third.php" method="get">
            Red<input type="checkbox" name="color" id="color" value="red">
            Green<input type="checkbox" name="color" id="color" value="green">
            Blue<input type="checkbox" name="color" id="color" value="blue">
            Cyan<input type="checkbox" name="color" id="color" value="cyan">
            Magenta<input type="checkbox" name="color" id="color" value="Magenta">
            Yellow<input type="checkbox" name="color" id="color" value="yellow">
            Black<input type="checkbox" name="color" id="color" value="black">
            <input type="submit" value="submit">
            </form>


            PHP (using $_GET) using third.php as your handler



            <?php

            $name = $_GET['color'];

            // optional
            // echo "You chose the following color(s): <br>";

            foreach ($name as $color){
            echo $color."<br />";
            }

            ?>


            Assuming having chosen red, green, blue and cyan as colors, will appear like this:



            red

            green

            blue

            cyan





            OPTION #2



            You can also check if a color was chosen. If none are chosen, then a seperate message will appear.



            <?php

            $name = $_GET['color'];

            if (isset($_GET['color'])) {
            echo "You chose the following color(s): <br>";

            foreach ($name as $color){
            echo $color."<br />";
            }
            } else {
            echo "You did not choose a color.";
            }

            ?>




            Additional options:



            To appear as a list: (<ul></ul> can be replaced by <ol></ol>)



            <?php

            $name = $_GET['color'];

            if (isset($_GET['color'])) {
            echo "You chose the following color(s): <br>";
            echo "<ul>";
            foreach ($name as $color){
            echo "<li>" .$color."</li>";
            }
            echo "</ul>";
            } else {
            echo "You did not choose a color.";
            }

            ?>




            Flag: (August the 5th, 2016)



            I've received 2 downvotes this morning and my comments we're removed; why? Whoever's doing this, is obvioulsy doing this with malice. The answer has received nothing but upvotes and now this. I mean seriously; wtf? – Fred -ii- 1 hour ago declined - People are free to vote how they want, as long as you're not being targeted. I see no evidence of that. Your comments about votes were noise, flagged as such, and removed.



            Answer to this: That's just the thing; I am.






            share|improve this answer















            A good method which is a favorite of mine and for many I'm sure, is to make use of foreach which will output each color you chose, and appear on screen one underneath each other.



            When it comes to using checkboxes, you kind of do not have a choice but to use foreach, and that's why you only get one value returned from your array.



            Here is an example using $_GET. You can however use $_POST and would need to make both directives match in both files in order to work properly.



            HTML FORM



            <form action="third.php" method="get">
            Red<input type="checkbox" name="color" id="color" value="red">
            Green<input type="checkbox" name="color" id="color" value="green">
            Blue<input type="checkbox" name="color" id="color" value="blue">
            Cyan<input type="checkbox" name="color" id="color" value="cyan">
            Magenta<input type="checkbox" name="color" id="color" value="Magenta">
            Yellow<input type="checkbox" name="color" id="color" value="yellow">
            Black<input type="checkbox" name="color" id="color" value="black">
            <input type="submit" value="submit">
            </form>


            PHP (using $_GET) using third.php as your handler



            <?php

            $name = $_GET['color'];

            // optional
            // echo "You chose the following color(s): <br>";

            foreach ($name as $color){
            echo $color."<br />";
            }

            ?>


            Assuming having chosen red, green, blue and cyan as colors, will appear like this:



            red

            green

            blue

            cyan





            OPTION #2



            You can also check if a color was chosen. If none are chosen, then a seperate message will appear.



            <?php

            $name = $_GET['color'];

            if (isset($_GET['color'])) {
            echo "You chose the following color(s): <br>";

            foreach ($name as $color){
            echo $color."<br />";
            }
            } else {
            echo "You did not choose a color.";
            }

            ?>




            Additional options:



            To appear as a list: (<ul></ul> can be replaced by <ol></ol>)



            <?php

            $name = $_GET['color'];

            if (isset($_GET['color'])) {
            echo "You chose the following color(s): <br>";
            echo "<ul>";
            foreach ($name as $color){
            echo "<li>" .$color."</li>";
            }
            echo "</ul>";
            } else {
            echo "You did not choose a color.";
            }

            ?>




            Flag: (August the 5th, 2016)



            I've received 2 downvotes this morning and my comments we're removed; why? Whoever's doing this, is obvioulsy doing this with malice. The answer has received nothing but upvotes and now this. I mean seriously; wtf? – Fred -ii- 1 hour ago declined - People are free to vote how they want, as long as you're not being targeted. I see no evidence of that. Your comments about votes were noise, flagged as such, and removed.



            Answer to this: That's just the thing; I am.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jul 13 '17 at 21:19









            Tim Holt

            2,61911219




            2,61911219










            answered Aug 24 '13 at 23:28









            Funk Forty NinerFunk Forty Niner

            1




            1








            • 5





              whoever just dv this, also dv another of my answers stackoverflow.com/a/18382062/1415724 obviously someone coming from answers in this question stackoverflow.com/q/43875382/1415724 I am sure of it. If they can't take the downvote for what should have been a comment, then they shouldn't post at all; IMHO. Downvote me if you want, I don't care, but "you" lose points in doing that, remember that.

              – Funk Forty Niner
              May 9 '17 at 16:54
















            • 5





              whoever just dv this, also dv another of my answers stackoverflow.com/a/18382062/1415724 obviously someone coming from answers in this question stackoverflow.com/q/43875382/1415724 I am sure of it. If they can't take the downvote for what should have been a comment, then they shouldn't post at all; IMHO. Downvote me if you want, I don't care, but "you" lose points in doing that, remember that.

              – Funk Forty Niner
              May 9 '17 at 16:54










            5




            5





            whoever just dv this, also dv another of my answers stackoverflow.com/a/18382062/1415724 obviously someone coming from answers in this question stackoverflow.com/q/43875382/1415724 I am sure of it. If they can't take the downvote for what should have been a comment, then they shouldn't post at all; IMHO. Downvote me if you want, I don't care, but "you" lose points in doing that, remember that.

            – Funk Forty Niner
            May 9 '17 at 16:54







            whoever just dv this, also dv another of my answers stackoverflow.com/a/18382062/1415724 obviously someone coming from answers in this question stackoverflow.com/q/43875382/1415724 I am sure of it. If they can't take the downvote for what should have been a comment, then they shouldn't post at all; IMHO. Downvote me if you want, I don't care, but "you" lose points in doing that, remember that.

            – Funk Forty Niner
            May 9 '17 at 16:54















            13














            (It's not action="get" or action="post" it's method="get" or method="post"



            Try to do it using post method:



            <form action="third.php" method="POST">
            Red<input type="checkbox" name="color" id="color" value="red">
            Green<input type="checkbox" name="color" id="color" value="green">
            Blue<input type="checkbox" name="color" id="color" value="blue">
            Cyan<input type="checkbox" name="color" id="color" value="cyan">
            Magenta<input type="checkbox" name="color" id="color" value="Magenta">
            Yellow<input type="checkbox" name="color" id="color" value="yellow">
            Black<input type="checkbox" name="color" id="color" value="black">
            <input type="submit" value="submit">
            </form>


            and in third.php



            or for a pericular field you colud get value in:



            $_POST['color'][0] //for RED
            $_POST['color'][1] // for GREEN





            share|improve this answer


























            • Ahh, so this is when things start to get wonky with PHP. $_POST is an array, and when looking at the solutions, I wondered, "$_POST['color'] is also it's own array, too, isn't it?"

              – DeltaFlyer
              Nov 30 '18 at 20:07


















            13














            (It's not action="get" or action="post" it's method="get" or method="post"



            Try to do it using post method:



            <form action="third.php" method="POST">
            Red<input type="checkbox" name="color" id="color" value="red">
            Green<input type="checkbox" name="color" id="color" value="green">
            Blue<input type="checkbox" name="color" id="color" value="blue">
            Cyan<input type="checkbox" name="color" id="color" value="cyan">
            Magenta<input type="checkbox" name="color" id="color" value="Magenta">
            Yellow<input type="checkbox" name="color" id="color" value="yellow">
            Black<input type="checkbox" name="color" id="color" value="black">
            <input type="submit" value="submit">
            </form>


            and in third.php



            or for a pericular field you colud get value in:



            $_POST['color'][0] //for RED
            $_POST['color'][1] // for GREEN





            share|improve this answer


























            • Ahh, so this is when things start to get wonky with PHP. $_POST is an array, and when looking at the solutions, I wondered, "$_POST['color'] is also it's own array, too, isn't it?"

              – DeltaFlyer
              Nov 30 '18 at 20:07
















            13












            13








            13







            (It's not action="get" or action="post" it's method="get" or method="post"



            Try to do it using post method:



            <form action="third.php" method="POST">
            Red<input type="checkbox" name="color" id="color" value="red">
            Green<input type="checkbox" name="color" id="color" value="green">
            Blue<input type="checkbox" name="color" id="color" value="blue">
            Cyan<input type="checkbox" name="color" id="color" value="cyan">
            Magenta<input type="checkbox" name="color" id="color" value="Magenta">
            Yellow<input type="checkbox" name="color" id="color" value="yellow">
            Black<input type="checkbox" name="color" id="color" value="black">
            <input type="submit" value="submit">
            </form>


            and in third.php



            or for a pericular field you colud get value in:



            $_POST['color'][0] //for RED
            $_POST['color'][1] // for GREEN





            share|improve this answer















            (It's not action="get" or action="post" it's method="get" or method="post"



            Try to do it using post method:



            <form action="third.php" method="POST">
            Red<input type="checkbox" name="color" id="color" value="red">
            Green<input type="checkbox" name="color" id="color" value="green">
            Blue<input type="checkbox" name="color" id="color" value="blue">
            Cyan<input type="checkbox" name="color" id="color" value="cyan">
            Magenta<input type="checkbox" name="color" id="color" value="Magenta">
            Yellow<input type="checkbox" name="color" id="color" value="yellow">
            Black<input type="checkbox" name="color" id="color" value="black">
            <input type="submit" value="submit">
            </form>


            and in third.php



            or for a pericular field you colud get value in:



            $_POST['color'][0] //for RED
            $_POST['color'][1] // for GREEN






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Aug 24 '13 at 23:13









            Funk Forty Niner

            1




            1










            answered Aug 24 '13 at 19:47









            RahulRahul

            1,0231819




            1,0231819













            • Ahh, so this is when things start to get wonky with PHP. $_POST is an array, and when looking at the solutions, I wondered, "$_POST['color'] is also it's own array, too, isn't it?"

              – DeltaFlyer
              Nov 30 '18 at 20:07





















            • Ahh, so this is when things start to get wonky with PHP. $_POST is an array, and when looking at the solutions, I wondered, "$_POST['color'] is also it's own array, too, isn't it?"

              – DeltaFlyer
              Nov 30 '18 at 20:07



















            Ahh, so this is when things start to get wonky with PHP. $_POST is an array, and when looking at the solutions, I wondered, "$_POST['color'] is also it's own array, too, isn't it?"

            – DeltaFlyer
            Nov 30 '18 at 20:07







            Ahh, so this is when things start to get wonky with PHP. $_POST is an array, and when looking at the solutions, I wondered, "$_POST['color'] is also it's own array, too, isn't it?"

            – DeltaFlyer
            Nov 30 '18 at 20:07













            9














            What i suggest is , its better to use post than get. here are some difference between post VS get



            Some notes on GET requests:




            1. GET requests can be cached

            2. GET requests remain in the browser history

            3. GET requests can be bookmarked

            4. GET requests should never be used when dealing with sensitive data

            5. GET requests have length restrictions

            6. GET requests should be used only to retrieve data


            Some notes on POST requests:




            1. POST requests are never cached

            2. POST requests do not remain in the browser history

            3. POST requests cannot be bookmarked

            4. POST requests have no restrictions on data length


            HTML Code



                        <html>
            <head></head>
            <body>
            <form action="output.php" method="post">
            Red<input type="checkbox" name="color" id="color" value="red">
            Green<input type="checkbox" name="color" id="color" value="green">
            Blue<input type="checkbox" name="color" id="color" value="blue">
            Cyan<input type="checkbox" name="color" id="color" value="cyan">
            Magenta<input type="checkbox" name="color" id="color" value="Magenta">
            Yellow<input type="checkbox" name="color" id="color" value="yellow">
            Black<input type="checkbox" name="color" id="color" value="black">
            <input type="submit" value="submit">
            </form>
            <body>
            </html>


            PHP code



                <?php


            if(isset($_POST['color'])) {
            $name = $_POST['color'];

            echo "You chose the following color(s): <br>";
            foreach ($name as $color){
            echo $color."<br />";
            }} // end brace for if(isset

            else {

            echo "You did not choose a color.";

            }

            ?>





            share|improve this answer


























            • What's about 2-dimension arrays? Does GET support something like this: <input type="checkbox" name="color[categoryA]" id="color" value="red"> <input type="checkbox" name="color[categoryA]" id="color" value="green"> which will work with mehtod=POST

              – The Bndr
              Apr 24 '18 at 11:56


















            9














            What i suggest is , its better to use post than get. here are some difference between post VS get



            Some notes on GET requests:




            1. GET requests can be cached

            2. GET requests remain in the browser history

            3. GET requests can be bookmarked

            4. GET requests should never be used when dealing with sensitive data

            5. GET requests have length restrictions

            6. GET requests should be used only to retrieve data


            Some notes on POST requests:




            1. POST requests are never cached

            2. POST requests do not remain in the browser history

            3. POST requests cannot be bookmarked

            4. POST requests have no restrictions on data length


            HTML Code



                        <html>
            <head></head>
            <body>
            <form action="output.php" method="post">
            Red<input type="checkbox" name="color" id="color" value="red">
            Green<input type="checkbox" name="color" id="color" value="green">
            Blue<input type="checkbox" name="color" id="color" value="blue">
            Cyan<input type="checkbox" name="color" id="color" value="cyan">
            Magenta<input type="checkbox" name="color" id="color" value="Magenta">
            Yellow<input type="checkbox" name="color" id="color" value="yellow">
            Black<input type="checkbox" name="color" id="color" value="black">
            <input type="submit" value="submit">
            </form>
            <body>
            </html>


            PHP code



                <?php


            if(isset($_POST['color'])) {
            $name = $_POST['color'];

            echo "You chose the following color(s): <br>";
            foreach ($name as $color){
            echo $color."<br />";
            }} // end brace for if(isset

            else {

            echo "You did not choose a color.";

            }

            ?>





            share|improve this answer


























            • What's about 2-dimension arrays? Does GET support something like this: <input type="checkbox" name="color[categoryA]" id="color" value="red"> <input type="checkbox" name="color[categoryA]" id="color" value="green"> which will work with mehtod=POST

              – The Bndr
              Apr 24 '18 at 11:56
















            9












            9








            9







            What i suggest is , its better to use post than get. here are some difference between post VS get



            Some notes on GET requests:




            1. GET requests can be cached

            2. GET requests remain in the browser history

            3. GET requests can be bookmarked

            4. GET requests should never be used when dealing with sensitive data

            5. GET requests have length restrictions

            6. GET requests should be used only to retrieve data


            Some notes on POST requests:




            1. POST requests are never cached

            2. POST requests do not remain in the browser history

            3. POST requests cannot be bookmarked

            4. POST requests have no restrictions on data length


            HTML Code



                        <html>
            <head></head>
            <body>
            <form action="output.php" method="post">
            Red<input type="checkbox" name="color" id="color" value="red">
            Green<input type="checkbox" name="color" id="color" value="green">
            Blue<input type="checkbox" name="color" id="color" value="blue">
            Cyan<input type="checkbox" name="color" id="color" value="cyan">
            Magenta<input type="checkbox" name="color" id="color" value="Magenta">
            Yellow<input type="checkbox" name="color" id="color" value="yellow">
            Black<input type="checkbox" name="color" id="color" value="black">
            <input type="submit" value="submit">
            </form>
            <body>
            </html>


            PHP code



                <?php


            if(isset($_POST['color'])) {
            $name = $_POST['color'];

            echo "You chose the following color(s): <br>";
            foreach ($name as $color){
            echo $color."<br />";
            }} // end brace for if(isset

            else {

            echo "You did not choose a color.";

            }

            ?>





            share|improve this answer















            What i suggest is , its better to use post than get. here are some difference between post VS get



            Some notes on GET requests:




            1. GET requests can be cached

            2. GET requests remain in the browser history

            3. GET requests can be bookmarked

            4. GET requests should never be used when dealing with sensitive data

            5. GET requests have length restrictions

            6. GET requests should be used only to retrieve data


            Some notes on POST requests:




            1. POST requests are never cached

            2. POST requests do not remain in the browser history

            3. POST requests cannot be bookmarked

            4. POST requests have no restrictions on data length


            HTML Code



                        <html>
            <head></head>
            <body>
            <form action="output.php" method="post">
            Red<input type="checkbox" name="color" id="color" value="red">
            Green<input type="checkbox" name="color" id="color" value="green">
            Blue<input type="checkbox" name="color" id="color" value="blue">
            Cyan<input type="checkbox" name="color" id="color" value="cyan">
            Magenta<input type="checkbox" name="color" id="color" value="Magenta">
            Yellow<input type="checkbox" name="color" id="color" value="yellow">
            Black<input type="checkbox" name="color" id="color" value="black">
            <input type="submit" value="submit">
            </form>
            <body>
            </html>


            PHP code



                <?php


            if(isset($_POST['color'])) {
            $name = $_POST['color'];

            echo "You chose the following color(s): <br>";
            foreach ($name as $color){
            echo $color."<br />";
            }} // end brace for if(isset

            else {

            echo "You did not choose a color.";

            }

            ?>






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Dec 24 '15 at 18:25









            Community

            11




            11










            answered Jun 10 '14 at 4:52









            Sathya BamanSathya Baman

            1,46822351




            1,46822351













            • What's about 2-dimension arrays? Does GET support something like this: <input type="checkbox" name="color[categoryA]" id="color" value="red"> <input type="checkbox" name="color[categoryA]" id="color" value="green"> which will work with mehtod=POST

              – The Bndr
              Apr 24 '18 at 11:56





















            • What's about 2-dimension arrays? Does GET support something like this: <input type="checkbox" name="color[categoryA]" id="color" value="red"> <input type="checkbox" name="color[categoryA]" id="color" value="green"> which will work with mehtod=POST

              – The Bndr
              Apr 24 '18 at 11:56



















            What's about 2-dimension arrays? Does GET support something like this: <input type="checkbox" name="color[categoryA]" id="color" value="red"> <input type="checkbox" name="color[categoryA]" id="color" value="green"> which will work with mehtod=POST

            – The Bndr
            Apr 24 '18 at 11:56







            What's about 2-dimension arrays? Does GET support something like this: <input type="checkbox" name="color[categoryA]" id="color" value="red"> <input type="checkbox" name="color[categoryA]" id="color" value="green"> which will work with mehtod=POST

            – The Bndr
            Apr 24 '18 at 11:56













            0














            Just for printing you can use as below :



            print_r($_GET['color']);


            or



            var_dump($_GET['color']);





            share|improve this answer




























              0














              Just for printing you can use as below :



              print_r($_GET['color']);


              or



              var_dump($_GET['color']);





              share|improve this answer


























                0












                0








                0







                Just for printing you can use as below :



                print_r($_GET['color']);


                or



                var_dump($_GET['color']);





                share|improve this answer













                Just for printing you can use as below :



                print_r($_GET['color']);


                or



                var_dump($_GET['color']);






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Apr 6 '15 at 17:10









                Vaibhavraj RohamVaibhavraj Roham

                600417




                600417























                    0














                    I think the value for the $_POST['color'] should be read only after checking if its set.



                    <?php


                    if(isset($_POST['color'])) {
                    $name = $_POST['color'];

                    echo "You chose the following color(s): <br>";
                    foreach ($name as $color){
                    echo $color."<br />";
                    }} // end brace for if(isset

                    else {

                    echo "You did not choose a color.";

                    }

                    ?>





                    share|improve this answer






























                      0














                      I think the value for the $_POST['color'] should be read only after checking if its set.



                      <?php


                      if(isset($_POST['color'])) {
                      $name = $_POST['color'];

                      echo "You chose the following color(s): <br>";
                      foreach ($name as $color){
                      echo $color."<br />";
                      }} // end brace for if(isset

                      else {

                      echo "You did not choose a color.";

                      }

                      ?>





                      share|improve this answer




























                        0












                        0








                        0







                        I think the value for the $_POST['color'] should be read only after checking if its set.



                        <?php


                        if(isset($_POST['color'])) {
                        $name = $_POST['color'];

                        echo "You chose the following color(s): <br>";
                        foreach ($name as $color){
                        echo $color."<br />";
                        }} // end brace for if(isset

                        else {

                        echo "You did not choose a color.";

                        }

                        ?>





                        share|improve this answer















                        I think the value for the $_POST['color'] should be read only after checking if its set.



                        <?php


                        if(isset($_POST['color'])) {
                        $name = $_POST['color'];

                        echo "You chose the following color(s): <br>";
                        foreach ($name as $color){
                        echo $color."<br />";
                        }} // end brace for if(isset

                        else {

                        echo "You did not choose a color.";

                        }

                        ?>






                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited Dec 24 '15 at 17:39

























                        answered Dec 24 '15 at 17:27









                        BlacboyBlacboy

                        32




                        32























                            0














                            Perhaps a better way is using the php function in_array() like this:



                            $style='V';//can be 'V'ertical or 'H'orizontal
                            $lineBreak=($style=='V')?'<br>':'';
                            $name='colors';//the name of your options
                            $Legent="Select your $name";//dress it up in a nice fieldset with a ledgent
                            $options=array('red','green','blue','orange','yellow','white','black');
                            $boxes='';//innitiate the list of tickboxes to be generated
                            if(isset($_REQUEST["$name"])){
                            //we shall use $_REQUEST but $_POST would be better
                            $Checked=$_REQUEST["$name"];
                            }else{
                            $Checked=array();
                            }
                            foreach($options as $option){
                            $checkmark=(in_array($option,$Checked))?'checked':'';
                            $nameAsArray=$name.'';//we would like the returned data to be in an array so we end with
                            $boxes.=($style=='V')?"<span class='label2' align='right'><b>$option : </b></span>":"<b>$option </b>";
                            $boxes.="<input style='width:2em;' type='checkbox' name='$nameAsArray' id='$option' value='$option' $checkmark >$lineBreak";
                            }

                            echo<<<EOF
                            <html>
                            <head></head>
                            <body>
                            <form name="Update" method="GET" action="{$_SERVER['PHP_SELF']}">n
                            <fieldset id="tickboxes" style="width:25em;">
                            <legend>{$Legent}</legend>
                            {$boxes}
                            </fieldset>
                            <button type="submit" >Submit Form</button>
                            </form>
                            <body>
                            </html>
                            EOF
                            ;


                            To start with we have created a variable $style to set if we want the options in a horizontal or vertical way. This will infrequence how we display our checkboxes. Next we set the $name for our options, this is needed as a name of the array where we want to keep our options.
                            I have created a loop here to construct each option as given in the array $options, then we check each item if it should be checked in our returned form. I believe this should simplify the way we can reproduce a form with checkboxes.






                            share|improve this answer




























                              0














                              Perhaps a better way is using the php function in_array() like this:



                              $style='V';//can be 'V'ertical or 'H'orizontal
                              $lineBreak=($style=='V')?'<br>':'';
                              $name='colors';//the name of your options
                              $Legent="Select your $name";//dress it up in a nice fieldset with a ledgent
                              $options=array('red','green','blue','orange','yellow','white','black');
                              $boxes='';//innitiate the list of tickboxes to be generated
                              if(isset($_REQUEST["$name"])){
                              //we shall use $_REQUEST but $_POST would be better
                              $Checked=$_REQUEST["$name"];
                              }else{
                              $Checked=array();
                              }
                              foreach($options as $option){
                              $checkmark=(in_array($option,$Checked))?'checked':'';
                              $nameAsArray=$name.'';//we would like the returned data to be in an array so we end with
                              $boxes.=($style=='V')?"<span class='label2' align='right'><b>$option : </b></span>":"<b>$option </b>";
                              $boxes.="<input style='width:2em;' type='checkbox' name='$nameAsArray' id='$option' value='$option' $checkmark >$lineBreak";
                              }

                              echo<<<EOF
                              <html>
                              <head></head>
                              <body>
                              <form name="Update" method="GET" action="{$_SERVER['PHP_SELF']}">n
                              <fieldset id="tickboxes" style="width:25em;">
                              <legend>{$Legent}</legend>
                              {$boxes}
                              </fieldset>
                              <button type="submit" >Submit Form</button>
                              </form>
                              <body>
                              </html>
                              EOF
                              ;


                              To start with we have created a variable $style to set if we want the options in a horizontal or vertical way. This will infrequence how we display our checkboxes. Next we set the $name for our options, this is needed as a name of the array where we want to keep our options.
                              I have created a loop here to construct each option as given in the array $options, then we check each item if it should be checked in our returned form. I believe this should simplify the way we can reproduce a form with checkboxes.






                              share|improve this answer


























                                0












                                0








                                0







                                Perhaps a better way is using the php function in_array() like this:



                                $style='V';//can be 'V'ertical or 'H'orizontal
                                $lineBreak=($style=='V')?'<br>':'';
                                $name='colors';//the name of your options
                                $Legent="Select your $name";//dress it up in a nice fieldset with a ledgent
                                $options=array('red','green','blue','orange','yellow','white','black');
                                $boxes='';//innitiate the list of tickboxes to be generated
                                if(isset($_REQUEST["$name"])){
                                //we shall use $_REQUEST but $_POST would be better
                                $Checked=$_REQUEST["$name"];
                                }else{
                                $Checked=array();
                                }
                                foreach($options as $option){
                                $checkmark=(in_array($option,$Checked))?'checked':'';
                                $nameAsArray=$name.'';//we would like the returned data to be in an array so we end with
                                $boxes.=($style=='V')?"<span class='label2' align='right'><b>$option : </b></span>":"<b>$option </b>";
                                $boxes.="<input style='width:2em;' type='checkbox' name='$nameAsArray' id='$option' value='$option' $checkmark >$lineBreak";
                                }

                                echo<<<EOF
                                <html>
                                <head></head>
                                <body>
                                <form name="Update" method="GET" action="{$_SERVER['PHP_SELF']}">n
                                <fieldset id="tickboxes" style="width:25em;">
                                <legend>{$Legent}</legend>
                                {$boxes}
                                </fieldset>
                                <button type="submit" >Submit Form</button>
                                </form>
                                <body>
                                </html>
                                EOF
                                ;


                                To start with we have created a variable $style to set if we want the options in a horizontal or vertical way. This will infrequence how we display our checkboxes. Next we set the $name for our options, this is needed as a name of the array where we want to keep our options.
                                I have created a loop here to construct each option as given in the array $options, then we check each item if it should be checked in our returned form. I believe this should simplify the way we can reproduce a form with checkboxes.






                                share|improve this answer













                                Perhaps a better way is using the php function in_array() like this:



                                $style='V';//can be 'V'ertical or 'H'orizontal
                                $lineBreak=($style=='V')?'<br>':'';
                                $name='colors';//the name of your options
                                $Legent="Select your $name";//dress it up in a nice fieldset with a ledgent
                                $options=array('red','green','blue','orange','yellow','white','black');
                                $boxes='';//innitiate the list of tickboxes to be generated
                                if(isset($_REQUEST["$name"])){
                                //we shall use $_REQUEST but $_POST would be better
                                $Checked=$_REQUEST["$name"];
                                }else{
                                $Checked=array();
                                }
                                foreach($options as $option){
                                $checkmark=(in_array($option,$Checked))?'checked':'';
                                $nameAsArray=$name.'';//we would like the returned data to be in an array so we end with
                                $boxes.=($style=='V')?"<span class='label2' align='right'><b>$option : </b></span>":"<b>$option </b>";
                                $boxes.="<input style='width:2em;' type='checkbox' name='$nameAsArray' id='$option' value='$option' $checkmark >$lineBreak";
                                }

                                echo<<<EOF
                                <html>
                                <head></head>
                                <body>
                                <form name="Update" method="GET" action="{$_SERVER['PHP_SELF']}">n
                                <fieldset id="tickboxes" style="width:25em;">
                                <legend>{$Legent}</legend>
                                {$boxes}
                                </fieldset>
                                <button type="submit" >Submit Form</button>
                                </form>
                                <body>
                                </html>
                                EOF
                                ;


                                To start with we have created a variable $style to set if we want the options in a horizontal or vertical way. This will infrequence how we display our checkboxes. Next we set the $name for our options, this is needed as a name of the array where we want to keep our options.
                                I have created a loop here to construct each option as given in the array $options, then we check each item if it should be checked in our returned form. I believe this should simplify the way we can reproduce a form with checkboxes.







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered May 25 '16 at 10:43









                                Cor CoolCor Cool

                                135




                                135























                                    0














                                    If you want to turn specific values in to new variables if they have been selected:



                                    // Retrieve array color and set as variable    
                                    $colors = $_GET['color'];
                                    // Use array_search to find the key for "red"
                                    $key_red = array_search('red', $colors);
                                    // If "red" exists, the key will be an integer (or FALSE)
                                    if (is_int($key_red)) {
                                    $red_color = 'Red was selected';
                                    }





                                    share|improve this answer






























                                      0














                                      If you want to turn specific values in to new variables if they have been selected:



                                      // Retrieve array color and set as variable    
                                      $colors = $_GET['color'];
                                      // Use array_search to find the key for "red"
                                      $key_red = array_search('red', $colors);
                                      // If "red" exists, the key will be an integer (or FALSE)
                                      if (is_int($key_red)) {
                                      $red_color = 'Red was selected';
                                      }





                                      share|improve this answer




























                                        0












                                        0








                                        0







                                        If you want to turn specific values in to new variables if they have been selected:



                                        // Retrieve array color and set as variable    
                                        $colors = $_GET['color'];
                                        // Use array_search to find the key for "red"
                                        $key_red = array_search('red', $colors);
                                        // If "red" exists, the key will be an integer (or FALSE)
                                        if (is_int($key_red)) {
                                        $red_color = 'Red was selected';
                                        }





                                        share|improve this answer















                                        If you want to turn specific values in to new variables if they have been selected:



                                        // Retrieve array color and set as variable    
                                        $colors = $_GET['color'];
                                        // Use array_search to find the key for "red"
                                        $key_red = array_search('red', $colors);
                                        // If "red" exists, the key will be an integer (or FALSE)
                                        if (is_int($key_red)) {
                                        $red_color = 'Red was selected';
                                        }






                                        share|improve this answer














                                        share|improve this answer



                                        share|improve this answer








                                        edited Nov 9 '17 at 22:26

























                                        answered Nov 5 '17 at 19:18







                                        user8890598






























                                            0














                                            foreach is the best way to get array of values.



                                            here the example code:
                                            html code:



                                            <form action="send.php" method="post">
                                            Red<input type="checkbox" name="color" id="color" value="red">
                                            Green<input type="checkbox" name="color" id="color" value="green">
                                            Blue<input type="checkbox" name="color" id="color" value="blue">
                                            Cyan<input type="checkbox" name="color" id="color" value="cyan">
                                            Magenta<input type="checkbox" name="color" id="color" value="Magenta">
                                            Yellow<input type="checkbox" name="color" id="color" value="yellow">
                                            Black<input type="checkbox" name="color" id="color" value="black">
                                            <input type="submit" value="submit">
                                            </form>


                                            phpcode:



                                            <?php

                                            $name = $POST['color'];



                                            foreach ($name as $color){
                                            echo $color."<br />";
                                            }

                                            ?>





                                            share|improve this answer
























                                            • cool answer !! it works

                                              – anonymouse
                                              Jun 19 '18 at 5:34
















                                            0














                                            foreach is the best way to get array of values.



                                            here the example code:
                                            html code:



                                            <form action="send.php" method="post">
                                            Red<input type="checkbox" name="color" id="color" value="red">
                                            Green<input type="checkbox" name="color" id="color" value="green">
                                            Blue<input type="checkbox" name="color" id="color" value="blue">
                                            Cyan<input type="checkbox" name="color" id="color" value="cyan">
                                            Magenta<input type="checkbox" name="color" id="color" value="Magenta">
                                            Yellow<input type="checkbox" name="color" id="color" value="yellow">
                                            Black<input type="checkbox" name="color" id="color" value="black">
                                            <input type="submit" value="submit">
                                            </form>


                                            phpcode:



                                            <?php

                                            $name = $POST['color'];



                                            foreach ($name as $color){
                                            echo $color."<br />";
                                            }

                                            ?>





                                            share|improve this answer
























                                            • cool answer !! it works

                                              – anonymouse
                                              Jun 19 '18 at 5:34














                                            0












                                            0








                                            0







                                            foreach is the best way to get array of values.



                                            here the example code:
                                            html code:



                                            <form action="send.php" method="post">
                                            Red<input type="checkbox" name="color" id="color" value="red">
                                            Green<input type="checkbox" name="color" id="color" value="green">
                                            Blue<input type="checkbox" name="color" id="color" value="blue">
                                            Cyan<input type="checkbox" name="color" id="color" value="cyan">
                                            Magenta<input type="checkbox" name="color" id="color" value="Magenta">
                                            Yellow<input type="checkbox" name="color" id="color" value="yellow">
                                            Black<input type="checkbox" name="color" id="color" value="black">
                                            <input type="submit" value="submit">
                                            </form>


                                            phpcode:



                                            <?php

                                            $name = $POST['color'];



                                            foreach ($name as $color){
                                            echo $color."<br />";
                                            }

                                            ?>





                                            share|improve this answer













                                            foreach is the best way to get array of values.



                                            here the example code:
                                            html code:



                                            <form action="send.php" method="post">
                                            Red<input type="checkbox" name="color" id="color" value="red">
                                            Green<input type="checkbox" name="color" id="color" value="green">
                                            Blue<input type="checkbox" name="color" id="color" value="blue">
                                            Cyan<input type="checkbox" name="color" id="color" value="cyan">
                                            Magenta<input type="checkbox" name="color" id="color" value="Magenta">
                                            Yellow<input type="checkbox" name="color" id="color" value="yellow">
                                            Black<input type="checkbox" name="color" id="color" value="black">
                                            <input type="submit" value="submit">
                                            </form>


                                            phpcode:



                                            <?php

                                            $name = $POST['color'];



                                            foreach ($name as $color){
                                            echo $color."<br />";
                                            }

                                            ?>






                                            share|improve this answer












                                            share|improve this answer



                                            share|improve this answer










                                            answered May 23 '18 at 3:40









                                            manikandanpachaiyappanmanikandanpachaiyappan

                                            436




                                            436













                                            • cool answer !! it works

                                              – anonymouse
                                              Jun 19 '18 at 5:34



















                                            • cool answer !! it works

                                              – anonymouse
                                              Jun 19 '18 at 5:34

















                                            cool answer !! it works

                                            – anonymouse
                                            Jun 19 '18 at 5:34





                                            cool answer !! it works

                                            – anonymouse
                                            Jun 19 '18 at 5:34











                                            0














                                            It's very simple.



                                            The checkbox field is like an input text. If you don't write anything in the field, it will say the field doesn't exist.



                                            <form method="post">
                                            <input type="checkbox" name="check">This is how it works!<br>
                                            <button type="submit" name="submit">Submit</button>
                                            </form>
                                            <?php
                                            if(isset($_POST['submit'])) {
                                            if(!isset($_POST['check'])) {
                                            echo "Not selected!";
                                            }else{
                                            echo "Selected!";
                                            }
                                            }
                                            ?>





                                            share|improve this answer






























                                              0














                                              It's very simple.



                                              The checkbox field is like an input text. If you don't write anything in the field, it will say the field doesn't exist.



                                              <form method="post">
                                              <input type="checkbox" name="check">This is how it works!<br>
                                              <button type="submit" name="submit">Submit</button>
                                              </form>
                                              <?php
                                              if(isset($_POST['submit'])) {
                                              if(!isset($_POST['check'])) {
                                              echo "Not selected!";
                                              }else{
                                              echo "Selected!";
                                              }
                                              }
                                              ?>





                                              share|improve this answer




























                                                0












                                                0








                                                0







                                                It's very simple.



                                                The checkbox field is like an input text. If you don't write anything in the field, it will say the field doesn't exist.



                                                <form method="post">
                                                <input type="checkbox" name="check">This is how it works!<br>
                                                <button type="submit" name="submit">Submit</button>
                                                </form>
                                                <?php
                                                if(isset($_POST['submit'])) {
                                                if(!isset($_POST['check'])) {
                                                echo "Not selected!";
                                                }else{
                                                echo "Selected!";
                                                }
                                                }
                                                ?>





                                                share|improve this answer















                                                It's very simple.



                                                The checkbox field is like an input text. If you don't write anything in the field, it will say the field doesn't exist.



                                                <form method="post">
                                                <input type="checkbox" name="check">This is how it works!<br>
                                                <button type="submit" name="submit">Submit</button>
                                                </form>
                                                <?php
                                                if(isset($_POST['submit'])) {
                                                if(!isset($_POST['check'])) {
                                                echo "Not selected!";
                                                }else{
                                                echo "Selected!";
                                                }
                                                }
                                                ?>






                                                share|improve this answer














                                                share|improve this answer



                                                share|improve this answer








                                                edited Oct 11 '18 at 17:29









                                                Clyff

                                                3,09311127




                                                3,09311127










                                                answered Oct 11 '18 at 16:09









                                                ArtyArty

                                                35




                                                35























                                                    -1














                                                    //retrive check box and gender value
                                                    $gender=$row['gender'];
                                                    $chkhobby=$row['chkhobby'];
                                                    <tr>
                                                    <th>GENDER</th>
                                                    <td>
                                                    Male<input type="radio" name="gender" value="1" <?php echo ($gender== '1') ? "checked" : "" ; ?>/>
                                                    Female<input type="radio" name="gender" value="0" <?php echo ($gender== '0') ? "checked" : "" ; ?>/>

                                                    </td>
                                                    </tr>
                                                    <tr>
                                                    <th>Hobbies</th>
                                                    <td>
                                                    <pre><?php //print_r($row);

                                                    $hby = @explode(",",$row['chkhobby']);
                                                    //print_r($hby);
                                                    ?></pre>
                                                    read<input id="check_1" type="checkbox" name="chkhobby" value="read" <?php if(in_array("read",$hby)){?> checked="checked"<?php }?>>
                                                    write<input id="check_2" type="checkbox" name="chkhobby" value="write" <?php if(in_array("write",$hby)){?> checked="checked"<?php }?>>
                                                    play<input id="check_4" type="checkbox" name="chkhobby" value="play" <?php if(in_array("play",$hby)){?> checked="checked"<?php }?>>


                                                    </td>
                                                    </tr>
                                                    //update
                                                    $gender=$_POST['gender'];
                                                    $chkhobby = implode(',', $_POST['chkhobby']);





                                                    share|improve this answer





















                                                    • 1





                                                      Please don't paste row code without explanation.

                                                      – Al Foиce ѫ
                                                      Aug 11 '16 at 9:11
















                                                    -1














                                                    //retrive check box and gender value
                                                    $gender=$row['gender'];
                                                    $chkhobby=$row['chkhobby'];
                                                    <tr>
                                                    <th>GENDER</th>
                                                    <td>
                                                    Male<input type="radio" name="gender" value="1" <?php echo ($gender== '1') ? "checked" : "" ; ?>/>
                                                    Female<input type="radio" name="gender" value="0" <?php echo ($gender== '0') ? "checked" : "" ; ?>/>

                                                    </td>
                                                    </tr>
                                                    <tr>
                                                    <th>Hobbies</th>
                                                    <td>
                                                    <pre><?php //print_r($row);

                                                    $hby = @explode(",",$row['chkhobby']);
                                                    //print_r($hby);
                                                    ?></pre>
                                                    read<input id="check_1" type="checkbox" name="chkhobby" value="read" <?php if(in_array("read",$hby)){?> checked="checked"<?php }?>>
                                                    write<input id="check_2" type="checkbox" name="chkhobby" value="write" <?php if(in_array("write",$hby)){?> checked="checked"<?php }?>>
                                                    play<input id="check_4" type="checkbox" name="chkhobby" value="play" <?php if(in_array("play",$hby)){?> checked="checked"<?php }?>>


                                                    </td>
                                                    </tr>
                                                    //update
                                                    $gender=$_POST['gender'];
                                                    $chkhobby = implode(',', $_POST['chkhobby']);





                                                    share|improve this answer





















                                                    • 1





                                                      Please don't paste row code without explanation.

                                                      – Al Foиce ѫ
                                                      Aug 11 '16 at 9:11














                                                    -1












                                                    -1








                                                    -1







                                                    //retrive check box and gender value
                                                    $gender=$row['gender'];
                                                    $chkhobby=$row['chkhobby'];
                                                    <tr>
                                                    <th>GENDER</th>
                                                    <td>
                                                    Male<input type="radio" name="gender" value="1" <?php echo ($gender== '1') ? "checked" : "" ; ?>/>
                                                    Female<input type="radio" name="gender" value="0" <?php echo ($gender== '0') ? "checked" : "" ; ?>/>

                                                    </td>
                                                    </tr>
                                                    <tr>
                                                    <th>Hobbies</th>
                                                    <td>
                                                    <pre><?php //print_r($row);

                                                    $hby = @explode(",",$row['chkhobby']);
                                                    //print_r($hby);
                                                    ?></pre>
                                                    read<input id="check_1" type="checkbox" name="chkhobby" value="read" <?php if(in_array("read",$hby)){?> checked="checked"<?php }?>>
                                                    write<input id="check_2" type="checkbox" name="chkhobby" value="write" <?php if(in_array("write",$hby)){?> checked="checked"<?php }?>>
                                                    play<input id="check_4" type="checkbox" name="chkhobby" value="play" <?php if(in_array("play",$hby)){?> checked="checked"<?php }?>>


                                                    </td>
                                                    </tr>
                                                    //update
                                                    $gender=$_POST['gender'];
                                                    $chkhobby = implode(',', $_POST['chkhobby']);





                                                    share|improve this answer















                                                    //retrive check box and gender value
                                                    $gender=$row['gender'];
                                                    $chkhobby=$row['chkhobby'];
                                                    <tr>
                                                    <th>GENDER</th>
                                                    <td>
                                                    Male<input type="radio" name="gender" value="1" <?php echo ($gender== '1') ? "checked" : "" ; ?>/>
                                                    Female<input type="radio" name="gender" value="0" <?php echo ($gender== '0') ? "checked" : "" ; ?>/>

                                                    </td>
                                                    </tr>
                                                    <tr>
                                                    <th>Hobbies</th>
                                                    <td>
                                                    <pre><?php //print_r($row);

                                                    $hby = @explode(",",$row['chkhobby']);
                                                    //print_r($hby);
                                                    ?></pre>
                                                    read<input id="check_1" type="checkbox" name="chkhobby" value="read" <?php if(in_array("read",$hby)){?> checked="checked"<?php }?>>
                                                    write<input id="check_2" type="checkbox" name="chkhobby" value="write" <?php if(in_array("write",$hby)){?> checked="checked"<?php }?>>
                                                    play<input id="check_4" type="checkbox" name="chkhobby" value="play" <?php if(in_array("play",$hby)){?> checked="checked"<?php }?>>


                                                    </td>
                                                    </tr>
                                                    //update
                                                    $gender=$_POST['gender'];
                                                    $chkhobby = implode(',', $_POST['chkhobby']);






                                                    share|improve this answer














                                                    share|improve this answer



                                                    share|improve this answer








                                                    edited Aug 11 '16 at 9:44









                                                    Al Foиce ѫ

                                                    3,16462440




                                                    3,16462440










                                                    answered Aug 11 '16 at 8:51









                                                    jigarjigar

                                                    144




                                                    144








                                                    • 1





                                                      Please don't paste row code without explanation.

                                                      – Al Foиce ѫ
                                                      Aug 11 '16 at 9:11














                                                    • 1





                                                      Please don't paste row code without explanation.

                                                      – Al Foиce ѫ
                                                      Aug 11 '16 at 9:11








                                                    1




                                                    1





                                                    Please don't paste row code without explanation.

                                                    – Al Foиce ѫ
                                                    Aug 11 '16 at 9:11





                                                    Please don't paste row code without explanation.

                                                    – Al Foиce ѫ
                                                    Aug 11 '16 at 9:11


















                                                    draft saved

                                                    draft discarded




















































                                                    Thanks for contributing an answer to Stack Overflow!


                                                    • Please be sure to answer the question. Provide details and share your research!

                                                    But avoid



                                                    • Asking for help, clarification, or responding to other answers.

                                                    • Making statements based on opinion; back them up with references or personal experience.


                                                    To learn more, see our tips on writing great answers.




                                                    draft saved


                                                    draft discarded














                                                    StackExchange.ready(
                                                    function () {
                                                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f18421988%2fgetting-checkbox-values-on-submit%23new-answer', 'question_page');
                                                    }
                                                    );

                                                    Post as a guest















                                                    Required, but never shown





















































                                                    Required, but never shown














                                                    Required, but never shown












                                                    Required, but never shown







                                                    Required, but never shown

































                                                    Required, but never shown














                                                    Required, but never shown












                                                    Required, but never shown







                                                    Required, but never shown







                                                    Popular posts from this blog

                                                    鏡平學校

                                                    ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

                                                    Why https connections are so slow when debugging (stepping over) in Java?