Get values of bootstrap dropdown in php The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceaccess the value of bootstrap-select picker in phpHow can I prevent SQL injection in PHP?What are valid values for the id attribute in HTML?Which “href” value should I use for JavaScript links, “#” or “javascript:void(0)”?PHP: Delete an element from an arrayConvert HTML + CSS to PDF with PHP?How do I get PHP errors to display?Reference — What does this symbol mean in PHP?What's the proper value for a checked attribute of an HTML checkbox?How to make Twitter Bootstrap menu dropdown on hover rather than clickWhy shouldn't I use mysql_* functions in PHP?

Create an outline of font

Change bounding box of math glyphs in LuaTeX

Take groceries in checked luggage

What aspect of planet Earth must be changed to prevent the industrial revolution?

Python - Fishing Simulator

What was the last x86 CPU that did not have the x87 floating-point unit built in?

How to stretch delimiters to envolve matrices inside of a kbordermatrix?

Can withdrawing asylum be illegal?

Can the DM override racial traits?

Can a 1st-level character have an ability score above 18?

Semisimplicity of the category of coherent sheaves?

Are my PIs rude or am I just being too sensitive?

Why can't devices on different VLANs, but on the same subnet, communicate?

Does Parliament need to approve the new Brexit delay to 31 October 2019?

ELI5: Why do they say that Israel would have been the fourth country to land a spacecraft on the Moon and why do they call it low cost?

I could not break this equation. Please help me

How should I replace vector<uint8_t>::const_iterator in an API?

Did the new image of black hole confirm the general theory of relativity?

Wolves and sheep

High Q peak in frequency response means what in time domain?

How is simplicity better than precision and clarity in prose?

What's the point in a preamp?

How did the audience guess the pentatonic scale in Bobby McFerrin's presentation?

Can the prologue be the backstory of your main character?



Get values of bootstrap dropdown in php



The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
The Ask Question Wizard is Live!
Data science time! April 2019 and salary with experienceaccess the value of bootstrap-select picker in phpHow can I prevent SQL injection in PHP?What are valid values for the id attribute in HTML?Which “href” value should I use for JavaScript links, “#” or “javascript:void(0)”?PHP: Delete an element from an arrayConvert HTML + CSS to PDF with PHP?How do I get PHP errors to display?Reference — What does this symbol mean in PHP?What's the proper value for a checked attribute of an HTML checkbox?How to make Twitter Bootstrap menu dropdown on hover rather than clickWhy shouldn't I use mysql_* functions in PHP?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








2















I have created a form with multiple fields like input type name, checkboxes and also a dropdown. My code for dropdown:



<div class="container">
<form action="selecttest.php" method="post">
<div class="dropdown">
<div class="dropdown-toggle somename1" data-toggle="dropdown"id="menu1"></div>
<ul class="dropdown-menu myclass numberom1" aria-labelledby="menu1" name="thenumbers">
<li value="one">One</li>
<li value="two">Two</li>
<li value="three">Three</li>
<li value="four">Four</li>
<li value="five">Five</li>
</ul>

</div>
<input type="submit" name ="submit"/>




I want to get the value of the selected <li> in the selecttest.php. The following code is not working:



$val = $_POST["thenumbers"];
echo "the Value selected is ".$val;


How can I get the value of the dropdown in the php page? There are other elements in the form as mentioned above so i cannot use jquery onclick event. And this is a non ajax form.



Thanks.










share|improve this question




























    2















    I have created a form with multiple fields like input type name, checkboxes and also a dropdown. My code for dropdown:



    <div class="container">
    <form action="selecttest.php" method="post">
    <div class="dropdown">
    <div class="dropdown-toggle somename1" data-toggle="dropdown"id="menu1"></div>
    <ul class="dropdown-menu myclass numberom1" aria-labelledby="menu1" name="thenumbers">
    <li value="one">One</li>
    <li value="two">Two</li>
    <li value="three">Three</li>
    <li value="four">Four</li>
    <li value="five">Five</li>
    </ul>

    </div>
    <input type="submit" name ="submit"/>




    I want to get the value of the selected <li> in the selecttest.php. The following code is not working:



    $val = $_POST["thenumbers"];
    echo "the Value selected is ".$val;


    How can I get the value of the dropdown in the php page? There are other elements in the form as mentioned above so i cannot use jquery onclick event. And this is a non ajax form.



    Thanks.










    share|improve this question
























      2












      2








      2


      2






      I have created a form with multiple fields like input type name, checkboxes and also a dropdown. My code for dropdown:



      <div class="container">
      <form action="selecttest.php" method="post">
      <div class="dropdown">
      <div class="dropdown-toggle somename1" data-toggle="dropdown"id="menu1"></div>
      <ul class="dropdown-menu myclass numberom1" aria-labelledby="menu1" name="thenumbers">
      <li value="one">One</li>
      <li value="two">Two</li>
      <li value="three">Three</li>
      <li value="four">Four</li>
      <li value="five">Five</li>
      </ul>

      </div>
      <input type="submit" name ="submit"/>




      I want to get the value of the selected <li> in the selecttest.php. The following code is not working:



      $val = $_POST["thenumbers"];
      echo "the Value selected is ".$val;


      How can I get the value of the dropdown in the php page? There are other elements in the form as mentioned above so i cannot use jquery onclick event. And this is a non ajax form.



      Thanks.










      share|improve this question














      I have created a form with multiple fields like input type name, checkboxes and also a dropdown. My code for dropdown:



      <div class="container">
      <form action="selecttest.php" method="post">
      <div class="dropdown">
      <div class="dropdown-toggle somename1" data-toggle="dropdown"id="menu1"></div>
      <ul class="dropdown-menu myclass numberom1" aria-labelledby="menu1" name="thenumbers">
      <li value="one">One</li>
      <li value="two">Two</li>
      <li value="three">Three</li>
      <li value="four">Four</li>
      <li value="five">Five</li>
      </ul>

      </div>
      <input type="submit" name ="submit"/>




      I want to get the value of the selected <li> in the selecttest.php. The following code is not working:



      $val = $_POST["thenumbers"];
      echo "the Value selected is ".$val;


      How can I get the value of the dropdown in the php page? There are other elements in the form as mentioned above so i cannot use jquery onclick event. And this is a non ajax form.



      Thanks.







      php html twitter-bootstrap






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 11 '16 at 15:42









      SomenameSomename

      93922044




      93922044






















          3 Answers
          3






          active

          oldest

          votes


















          7














          A dropdown menu is not the same as a select input.



          Within a form, the syntax for a select input (like yours, within Bootstrap) would be:



          <label for="select_1">Select list:</label>
          <select class="form-control" id="select_1" name="thenumbers">
          <option value="one">One</option>
          <option value="two">Two</option>
          <option value="three">Three</option>
          <option value="four">Four</option>
          </select>


          So long as the select has an attribute name with value "thenumbers", and the select is within the form that is being submitted, you will be able to get the value of the selected element in PHP with:



          $val = $_POST["thenumbers"];
          echo "the Value selected is ".$val;



          To use the Bootstrap dropdown as a faux select, you can use JavaScript. Here is an example with jQuery:



          HTML



          <!-- Create dropdown and add specific class '.thenumbers' to ul element -->
          <div class="dropdown">
          <div class="dropdown-toggle somename1" data-toggle="dropdown"id="menu1"></div>
          <ul class="dropdown-menu myclass numberom1 thenumbers" aria-labelledby="menu1" name="thenumbers">
          <li value="one">One</li>
          <li value="two">Two</li>
          <li value="three">Three</li>
          <li value="four">Four</li>
          <li value="five">Five</li>
          </ul>
          </div>

          <!-- Create a hidden input -->
          <input type='hidden' name='thenumbers'>


          jQuery



          $(function()
          //Listen for a click on any of the dropdown items
          $(".thenumbers li").click(function()
          //Get the value
          var value = $(this).attr("value");
          //Put the retrieved value into the hidden input
          $("input[name='thenumbers']").val(value);
          );
          );


          That way (as long as the hidden input is within the form), when the form is submitted, the "thenumbers" input value will be the last selected dropdown option.






          share|improve this answer

























          • So there is no way I can use the dropdown in Bootstrap as a form element yeah?

            – Somename
            Aug 11 '16 at 15:57






          • 1





            Not really - you can use JavaScript to alter an input based on a user clicking on a dropdown item, but you can also style a select box with CSS to look like a menu (which is much cleaner and easier!)

            – Ben
            Aug 11 '16 at 16:01






          • 1





            @Somename I've added a quick makeshift JavaScript solution.

            – Ben
            Aug 11 '16 at 16:11











          • It works like a charm! Thank you !!

            – Somename
            Aug 11 '16 at 16:59











          • I will try one for multiple selects by creating a array withing an object. Thanks for the logic. cheers!!!

            – Somename
            Aug 11 '16 at 17:01


















          1














          Your form is not submitting because there is no submit button.Try this code.



          HTML CODE



          <form action="selecttest.php" method="post">
          <div class="dropdown" >

          <select class="form-control" name="thenumbers">
          <option value="one">One</option>
          <option value="two">Two</option>
          <option value="three">Three</option>
          <option value="four">Four</option>
          </select>

          </div>

          <input type="submit" name ="send"/>

          </form>


          PHP CODE



          if(isset($_POST['send']))

          $val = $_POST["thenumbers"];
          echo "the Value selected is ".$val;






          share|improve this answer
































            0














            When using Input group-bootstrap, you can get values in the PHP page by writing your code like this:



            HTML/Bootstrap



            <select name = "thenumbers" class="btn btn-outline-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
            <option value ="one" name ="one">One</option>
            <option value ="two" name ="two">Two</option>
            <option value ="three" name ="three">Three</option>
            </select>
            <input class="form-control border-secondary py-2" name="searchterm" type="text" >
            <div class="input-group-append">
            <button class="btn btn-primary" name="submit" type="submit" value ="su bmit">
            <i class="fa fa-search"></i>
            </button>
            </div>


            PHP code:



            <?php
            if(isset($_POST['submit']) && !empty($_POST['searchterm']))
            if(isset($_POST['thenumbers'])
            $val = $_POST['thenumbers'];
            echo $val;







            share|improve this answer























              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%2f38900832%2fget-values-of-bootstrap-dropdown-in-php%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              7














              A dropdown menu is not the same as a select input.



              Within a form, the syntax for a select input (like yours, within Bootstrap) would be:



              <label for="select_1">Select list:</label>
              <select class="form-control" id="select_1" name="thenumbers">
              <option value="one">One</option>
              <option value="two">Two</option>
              <option value="three">Three</option>
              <option value="four">Four</option>
              </select>


              So long as the select has an attribute name with value "thenumbers", and the select is within the form that is being submitted, you will be able to get the value of the selected element in PHP with:



              $val = $_POST["thenumbers"];
              echo "the Value selected is ".$val;



              To use the Bootstrap dropdown as a faux select, you can use JavaScript. Here is an example with jQuery:



              HTML



              <!-- Create dropdown and add specific class '.thenumbers' to ul element -->
              <div class="dropdown">
              <div class="dropdown-toggle somename1" data-toggle="dropdown"id="menu1"></div>
              <ul class="dropdown-menu myclass numberom1 thenumbers" aria-labelledby="menu1" name="thenumbers">
              <li value="one">One</li>
              <li value="two">Two</li>
              <li value="three">Three</li>
              <li value="four">Four</li>
              <li value="five">Five</li>
              </ul>
              </div>

              <!-- Create a hidden input -->
              <input type='hidden' name='thenumbers'>


              jQuery



              $(function()
              //Listen for a click on any of the dropdown items
              $(".thenumbers li").click(function()
              //Get the value
              var value = $(this).attr("value");
              //Put the retrieved value into the hidden input
              $("input[name='thenumbers']").val(value);
              );
              );


              That way (as long as the hidden input is within the form), when the form is submitted, the "thenumbers" input value will be the last selected dropdown option.






              share|improve this answer

























              • So there is no way I can use the dropdown in Bootstrap as a form element yeah?

                – Somename
                Aug 11 '16 at 15:57






              • 1





                Not really - you can use JavaScript to alter an input based on a user clicking on a dropdown item, but you can also style a select box with CSS to look like a menu (which is much cleaner and easier!)

                – Ben
                Aug 11 '16 at 16:01






              • 1





                @Somename I've added a quick makeshift JavaScript solution.

                – Ben
                Aug 11 '16 at 16:11











              • It works like a charm! Thank you !!

                – Somename
                Aug 11 '16 at 16:59











              • I will try one for multiple selects by creating a array withing an object. Thanks for the logic. cheers!!!

                – Somename
                Aug 11 '16 at 17:01















              7














              A dropdown menu is not the same as a select input.



              Within a form, the syntax for a select input (like yours, within Bootstrap) would be:



              <label for="select_1">Select list:</label>
              <select class="form-control" id="select_1" name="thenumbers">
              <option value="one">One</option>
              <option value="two">Two</option>
              <option value="three">Three</option>
              <option value="four">Four</option>
              </select>


              So long as the select has an attribute name with value "thenumbers", and the select is within the form that is being submitted, you will be able to get the value of the selected element in PHP with:



              $val = $_POST["thenumbers"];
              echo "the Value selected is ".$val;



              To use the Bootstrap dropdown as a faux select, you can use JavaScript. Here is an example with jQuery:



              HTML



              <!-- Create dropdown and add specific class '.thenumbers' to ul element -->
              <div class="dropdown">
              <div class="dropdown-toggle somename1" data-toggle="dropdown"id="menu1"></div>
              <ul class="dropdown-menu myclass numberom1 thenumbers" aria-labelledby="menu1" name="thenumbers">
              <li value="one">One</li>
              <li value="two">Two</li>
              <li value="three">Three</li>
              <li value="four">Four</li>
              <li value="five">Five</li>
              </ul>
              </div>

              <!-- Create a hidden input -->
              <input type='hidden' name='thenumbers'>


              jQuery



              $(function()
              //Listen for a click on any of the dropdown items
              $(".thenumbers li").click(function()
              //Get the value
              var value = $(this).attr("value");
              //Put the retrieved value into the hidden input
              $("input[name='thenumbers']").val(value);
              );
              );


              That way (as long as the hidden input is within the form), when the form is submitted, the "thenumbers" input value will be the last selected dropdown option.






              share|improve this answer

























              • So there is no way I can use the dropdown in Bootstrap as a form element yeah?

                – Somename
                Aug 11 '16 at 15:57






              • 1





                Not really - you can use JavaScript to alter an input based on a user clicking on a dropdown item, but you can also style a select box with CSS to look like a menu (which is much cleaner and easier!)

                – Ben
                Aug 11 '16 at 16:01






              • 1





                @Somename I've added a quick makeshift JavaScript solution.

                – Ben
                Aug 11 '16 at 16:11











              • It works like a charm! Thank you !!

                – Somename
                Aug 11 '16 at 16:59











              • I will try one for multiple selects by creating a array withing an object. Thanks for the logic. cheers!!!

                – Somename
                Aug 11 '16 at 17:01













              7












              7








              7







              A dropdown menu is not the same as a select input.



              Within a form, the syntax for a select input (like yours, within Bootstrap) would be:



              <label for="select_1">Select list:</label>
              <select class="form-control" id="select_1" name="thenumbers">
              <option value="one">One</option>
              <option value="two">Two</option>
              <option value="three">Three</option>
              <option value="four">Four</option>
              </select>


              So long as the select has an attribute name with value "thenumbers", and the select is within the form that is being submitted, you will be able to get the value of the selected element in PHP with:



              $val = $_POST["thenumbers"];
              echo "the Value selected is ".$val;



              To use the Bootstrap dropdown as a faux select, you can use JavaScript. Here is an example with jQuery:



              HTML



              <!-- Create dropdown and add specific class '.thenumbers' to ul element -->
              <div class="dropdown">
              <div class="dropdown-toggle somename1" data-toggle="dropdown"id="menu1"></div>
              <ul class="dropdown-menu myclass numberom1 thenumbers" aria-labelledby="menu1" name="thenumbers">
              <li value="one">One</li>
              <li value="two">Two</li>
              <li value="three">Three</li>
              <li value="four">Four</li>
              <li value="five">Five</li>
              </ul>
              </div>

              <!-- Create a hidden input -->
              <input type='hidden' name='thenumbers'>


              jQuery



              $(function()
              //Listen for a click on any of the dropdown items
              $(".thenumbers li").click(function()
              //Get the value
              var value = $(this).attr("value");
              //Put the retrieved value into the hidden input
              $("input[name='thenumbers']").val(value);
              );
              );


              That way (as long as the hidden input is within the form), when the form is submitted, the "thenumbers" input value will be the last selected dropdown option.






              share|improve this answer















              A dropdown menu is not the same as a select input.



              Within a form, the syntax for a select input (like yours, within Bootstrap) would be:



              <label for="select_1">Select list:</label>
              <select class="form-control" id="select_1" name="thenumbers">
              <option value="one">One</option>
              <option value="two">Two</option>
              <option value="three">Three</option>
              <option value="four">Four</option>
              </select>


              So long as the select has an attribute name with value "thenumbers", and the select is within the form that is being submitted, you will be able to get the value of the selected element in PHP with:



              $val = $_POST["thenumbers"];
              echo "the Value selected is ".$val;



              To use the Bootstrap dropdown as a faux select, you can use JavaScript. Here is an example with jQuery:



              HTML



              <!-- Create dropdown and add specific class '.thenumbers' to ul element -->
              <div class="dropdown">
              <div class="dropdown-toggle somename1" data-toggle="dropdown"id="menu1"></div>
              <ul class="dropdown-menu myclass numberom1 thenumbers" aria-labelledby="menu1" name="thenumbers">
              <li value="one">One</li>
              <li value="two">Two</li>
              <li value="three">Three</li>
              <li value="four">Four</li>
              <li value="five">Five</li>
              </ul>
              </div>

              <!-- Create a hidden input -->
              <input type='hidden' name='thenumbers'>


              jQuery



              $(function()
              //Listen for a click on any of the dropdown items
              $(".thenumbers li").click(function()
              //Get the value
              var value = $(this).attr("value");
              //Put the retrieved value into the hidden input
              $("input[name='thenumbers']").val(value);
              );
              );


              That way (as long as the hidden input is within the form), when the form is submitted, the "thenumbers" input value will be the last selected dropdown option.







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Aug 15 '16 at 8:57

























              answered Aug 11 '16 at 15:47









              BenBen

              7,23073366




              7,23073366












              • So there is no way I can use the dropdown in Bootstrap as a form element yeah?

                – Somename
                Aug 11 '16 at 15:57






              • 1





                Not really - you can use JavaScript to alter an input based on a user clicking on a dropdown item, but you can also style a select box with CSS to look like a menu (which is much cleaner and easier!)

                – Ben
                Aug 11 '16 at 16:01






              • 1





                @Somename I've added a quick makeshift JavaScript solution.

                – Ben
                Aug 11 '16 at 16:11











              • It works like a charm! Thank you !!

                – Somename
                Aug 11 '16 at 16:59











              • I will try one for multiple selects by creating a array withing an object. Thanks for the logic. cheers!!!

                – Somename
                Aug 11 '16 at 17:01

















              • So there is no way I can use the dropdown in Bootstrap as a form element yeah?

                – Somename
                Aug 11 '16 at 15:57






              • 1





                Not really - you can use JavaScript to alter an input based on a user clicking on a dropdown item, but you can also style a select box with CSS to look like a menu (which is much cleaner and easier!)

                – Ben
                Aug 11 '16 at 16:01






              • 1





                @Somename I've added a quick makeshift JavaScript solution.

                – Ben
                Aug 11 '16 at 16:11











              • It works like a charm! Thank you !!

                – Somename
                Aug 11 '16 at 16:59











              • I will try one for multiple selects by creating a array withing an object. Thanks for the logic. cheers!!!

                – Somename
                Aug 11 '16 at 17:01
















              So there is no way I can use the dropdown in Bootstrap as a form element yeah?

              – Somename
              Aug 11 '16 at 15:57





              So there is no way I can use the dropdown in Bootstrap as a form element yeah?

              – Somename
              Aug 11 '16 at 15:57




              1




              1





              Not really - you can use JavaScript to alter an input based on a user clicking on a dropdown item, but you can also style a select box with CSS to look like a menu (which is much cleaner and easier!)

              – Ben
              Aug 11 '16 at 16:01





              Not really - you can use JavaScript to alter an input based on a user clicking on a dropdown item, but you can also style a select box with CSS to look like a menu (which is much cleaner and easier!)

              – Ben
              Aug 11 '16 at 16:01




              1




              1





              @Somename I've added a quick makeshift JavaScript solution.

              – Ben
              Aug 11 '16 at 16:11





              @Somename I've added a quick makeshift JavaScript solution.

              – Ben
              Aug 11 '16 at 16:11













              It works like a charm! Thank you !!

              – Somename
              Aug 11 '16 at 16:59





              It works like a charm! Thank you !!

              – Somename
              Aug 11 '16 at 16:59













              I will try one for multiple selects by creating a array withing an object. Thanks for the logic. cheers!!!

              – Somename
              Aug 11 '16 at 17:01





              I will try one for multiple selects by creating a array withing an object. Thanks for the logic. cheers!!!

              – Somename
              Aug 11 '16 at 17:01













              1














              Your form is not submitting because there is no submit button.Try this code.



              HTML CODE



              <form action="selecttest.php" method="post">
              <div class="dropdown" >

              <select class="form-control" name="thenumbers">
              <option value="one">One</option>
              <option value="two">Two</option>
              <option value="three">Three</option>
              <option value="four">Four</option>
              </select>

              </div>

              <input type="submit" name ="send"/>

              </form>


              PHP CODE



              if(isset($_POST['send']))

              $val = $_POST["thenumbers"];
              echo "the Value selected is ".$val;






              share|improve this answer





























                1














                Your form is not submitting because there is no submit button.Try this code.



                HTML CODE



                <form action="selecttest.php" method="post">
                <div class="dropdown" >

                <select class="form-control" name="thenumbers">
                <option value="one">One</option>
                <option value="two">Two</option>
                <option value="three">Three</option>
                <option value="four">Four</option>
                </select>

                </div>

                <input type="submit" name ="send"/>

                </form>


                PHP CODE



                if(isset($_POST['send']))

                $val = $_POST["thenumbers"];
                echo "the Value selected is ".$val;






                share|improve this answer



























                  1












                  1








                  1







                  Your form is not submitting because there is no submit button.Try this code.



                  HTML CODE



                  <form action="selecttest.php" method="post">
                  <div class="dropdown" >

                  <select class="form-control" name="thenumbers">
                  <option value="one">One</option>
                  <option value="two">Two</option>
                  <option value="three">Three</option>
                  <option value="four">Four</option>
                  </select>

                  </div>

                  <input type="submit" name ="send"/>

                  </form>


                  PHP CODE



                  if(isset($_POST['send']))

                  $val = $_POST["thenumbers"];
                  echo "the Value selected is ".$val;






                  share|improve this answer















                  Your form is not submitting because there is no submit button.Try this code.



                  HTML CODE



                  <form action="selecttest.php" method="post">
                  <div class="dropdown" >

                  <select class="form-control" name="thenumbers">
                  <option value="one">One</option>
                  <option value="two">Two</option>
                  <option value="three">Three</option>
                  <option value="four">Four</option>
                  </select>

                  </div>

                  <input type="submit" name ="send"/>

                  </form>


                  PHP CODE



                  if(isset($_POST['send']))

                  $val = $_POST["thenumbers"];
                  echo "the Value selected is ".$val;







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Sep 22 '16 at 16:12

























                  answered Sep 22 '16 at 15:58









                  Syed Muneeb Ul HasanSyed Muneeb Ul Hasan

                  18714




                  18714





















                      0














                      When using Input group-bootstrap, you can get values in the PHP page by writing your code like this:



                      HTML/Bootstrap



                      <select name = "thenumbers" class="btn btn-outline-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                      <option value ="one" name ="one">One</option>
                      <option value ="two" name ="two">Two</option>
                      <option value ="three" name ="three">Three</option>
                      </select>
                      <input class="form-control border-secondary py-2" name="searchterm" type="text" >
                      <div class="input-group-append">
                      <button class="btn btn-primary" name="submit" type="submit" value ="su bmit">
                      <i class="fa fa-search"></i>
                      </button>
                      </div>


                      PHP code:



                      <?php
                      if(isset($_POST['submit']) && !empty($_POST['searchterm']))
                      if(isset($_POST['thenumbers'])
                      $val = $_POST['thenumbers'];
                      echo $val;







                      share|improve this answer



























                        0














                        When using Input group-bootstrap, you can get values in the PHP page by writing your code like this:



                        HTML/Bootstrap



                        <select name = "thenumbers" class="btn btn-outline-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        <option value ="one" name ="one">One</option>
                        <option value ="two" name ="two">Two</option>
                        <option value ="three" name ="three">Three</option>
                        </select>
                        <input class="form-control border-secondary py-2" name="searchterm" type="text" >
                        <div class="input-group-append">
                        <button class="btn btn-primary" name="submit" type="submit" value ="su bmit">
                        <i class="fa fa-search"></i>
                        </button>
                        </div>


                        PHP code:



                        <?php
                        if(isset($_POST['submit']) && !empty($_POST['searchterm']))
                        if(isset($_POST['thenumbers'])
                        $val = $_POST['thenumbers'];
                        echo $val;







                        share|improve this answer

























                          0












                          0








                          0







                          When using Input group-bootstrap, you can get values in the PHP page by writing your code like this:



                          HTML/Bootstrap



                          <select name = "thenumbers" class="btn btn-outline-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                          <option value ="one" name ="one">One</option>
                          <option value ="two" name ="two">Two</option>
                          <option value ="three" name ="three">Three</option>
                          </select>
                          <input class="form-control border-secondary py-2" name="searchterm" type="text" >
                          <div class="input-group-append">
                          <button class="btn btn-primary" name="submit" type="submit" value ="su bmit">
                          <i class="fa fa-search"></i>
                          </button>
                          </div>


                          PHP code:



                          <?php
                          if(isset($_POST['submit']) && !empty($_POST['searchterm']))
                          if(isset($_POST['thenumbers'])
                          $val = $_POST['thenumbers'];
                          echo $val;







                          share|improve this answer













                          When using Input group-bootstrap, you can get values in the PHP page by writing your code like this:



                          HTML/Bootstrap



                          <select name = "thenumbers" class="btn btn-outline-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                          <option value ="one" name ="one">One</option>
                          <option value ="two" name ="two">Two</option>
                          <option value ="three" name ="three">Three</option>
                          </select>
                          <input class="form-control border-secondary py-2" name="searchterm" type="text" >
                          <div class="input-group-append">
                          <button class="btn btn-primary" name="submit" type="submit" value ="su bmit">
                          <i class="fa fa-search"></i>
                          </button>
                          </div>


                          PHP code:



                          <?php
                          if(isset($_POST['submit']) && !empty($_POST['searchterm']))
                          if(isset($_POST['thenumbers'])
                          $val = $_POST['thenumbers'];
                          echo $val;








                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Mar 22 at 6:34









                          MselaMsela

                          408




                          408



























                              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%2f38900832%2fget-values-of-bootstrap-dropdown-in-php%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

                              Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                              SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                              은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현