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;
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
add a comment |
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
add a comment |
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
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
php html twitter-bootstrap
asked Aug 11 '16 at 15:42
SomenameSomename
93922044
93922044
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
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.
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 aselect
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
|
show 1 more comment
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;
add a comment |
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;
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
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 aselect
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
|
show 1 more comment
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.
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 aselect
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
|
show 1 more comment
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.
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.
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 aselect
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
|
show 1 more comment
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 aselect
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
|
show 1 more comment
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;
add a comment |
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;
add a comment |
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;
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;
edited Sep 22 '16 at 16:12
answered Sep 22 '16 at 15:58
Syed Muneeb Ul HasanSyed Muneeb Ul Hasan
18714
18714
add a comment |
add a comment |
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;
add a comment |
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;
add a comment |
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;
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;
answered Mar 22 at 6:34
MselaMsela
408
408
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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