How to show pictures based on what answer filled in on the form?
I have 8 buttons, each button can be clicked, when you made your selection you go search, after you searched I need to show pictures based on what buttons are clicked before searching. I already have button that has be choosen in a array in PHP, but I dont know how to show the picture that has to be showed of depending on what buttons are used.
<form id="search" action="programmer.php" method="get">
<div data-toggle="buttons">
<div class="container">
<div class="row">
<div class="col-sm-4">
<label class="btn btn-primary btn-block btn-lg-lg">
<input type="checkbox"style="display: none;" name="lang" value="html" autocomplete="off">HTML
</label>
</div>
<div class="col-sm-4">
<label class="btn btn-primary btn-block btn-lg-lg">
<input type="checkbox" style="display: none;" name="lang" value="css" autocomplete="off">CSS
</label>
</div>
<div class="col-sm-4">
<label class="btn btn-primary btn-block btn-lg-lg">
<input type="checkbox" style="display: none;" name="lang" value="javascript" autocomplete="off">Javascript
</label>
</div>
</div>
</div>
<div class="container">
<input type="submit" value="Search" class="btn btn-primary btn-lg btn-block" >
</div>
This is the PHP only showing off that I got the arrays:
<?php
print_r($_GET["lang"]);
?>
php html
add a comment |
I have 8 buttons, each button can be clicked, when you made your selection you go search, after you searched I need to show pictures based on what buttons are clicked before searching. I already have button that has be choosen in a array in PHP, but I dont know how to show the picture that has to be showed of depending on what buttons are used.
<form id="search" action="programmer.php" method="get">
<div data-toggle="buttons">
<div class="container">
<div class="row">
<div class="col-sm-4">
<label class="btn btn-primary btn-block btn-lg-lg">
<input type="checkbox"style="display: none;" name="lang" value="html" autocomplete="off">HTML
</label>
</div>
<div class="col-sm-4">
<label class="btn btn-primary btn-block btn-lg-lg">
<input type="checkbox" style="display: none;" name="lang" value="css" autocomplete="off">CSS
</label>
</div>
<div class="col-sm-4">
<label class="btn btn-primary btn-block btn-lg-lg">
<input type="checkbox" style="display: none;" name="lang" value="javascript" autocomplete="off">Javascript
</label>
</div>
</div>
</div>
<div class="container">
<input type="submit" value="Search" class="btn btn-primary btn-lg btn-block" >
</div>
This is the PHP only showing off that I got the arrays:
<?php
print_r($_GET["lang"]);
?>
php html
The images should be shown at the same page or Is there a redirect to a new page? You can save the path in a variable in php and the use it in the html code <img src='<?php echo $path;?>'>
– q-jack
Nov 12 '18 at 9:50
Is there any code missing in your question, such as JavaScript? Your buttons are labels, so I am assuming you have some JavaScript to indicate which were clicked? Or is that the answer you are looking for? And you are in fact sending the entire array of data except for the ones you clicked? Either way, you must have some existing functionality regarding your buttons?
– Martin
Nov 12 '18 at 9:57
It is redirecting to a new page. There is no code missing, you can see which buttons are clicked because i added a bootstrap class
– Zeba
Nov 12 '18 at 10:12
add a comment |
I have 8 buttons, each button can be clicked, when you made your selection you go search, after you searched I need to show pictures based on what buttons are clicked before searching. I already have button that has be choosen in a array in PHP, but I dont know how to show the picture that has to be showed of depending on what buttons are used.
<form id="search" action="programmer.php" method="get">
<div data-toggle="buttons">
<div class="container">
<div class="row">
<div class="col-sm-4">
<label class="btn btn-primary btn-block btn-lg-lg">
<input type="checkbox"style="display: none;" name="lang" value="html" autocomplete="off">HTML
</label>
</div>
<div class="col-sm-4">
<label class="btn btn-primary btn-block btn-lg-lg">
<input type="checkbox" style="display: none;" name="lang" value="css" autocomplete="off">CSS
</label>
</div>
<div class="col-sm-4">
<label class="btn btn-primary btn-block btn-lg-lg">
<input type="checkbox" style="display: none;" name="lang" value="javascript" autocomplete="off">Javascript
</label>
</div>
</div>
</div>
<div class="container">
<input type="submit" value="Search" class="btn btn-primary btn-lg btn-block" >
</div>
This is the PHP only showing off that I got the arrays:
<?php
print_r($_GET["lang"]);
?>
php html
I have 8 buttons, each button can be clicked, when you made your selection you go search, after you searched I need to show pictures based on what buttons are clicked before searching. I already have button that has be choosen in a array in PHP, but I dont know how to show the picture that has to be showed of depending on what buttons are used.
<form id="search" action="programmer.php" method="get">
<div data-toggle="buttons">
<div class="container">
<div class="row">
<div class="col-sm-4">
<label class="btn btn-primary btn-block btn-lg-lg">
<input type="checkbox"style="display: none;" name="lang" value="html" autocomplete="off">HTML
</label>
</div>
<div class="col-sm-4">
<label class="btn btn-primary btn-block btn-lg-lg">
<input type="checkbox" style="display: none;" name="lang" value="css" autocomplete="off">CSS
</label>
</div>
<div class="col-sm-4">
<label class="btn btn-primary btn-block btn-lg-lg">
<input type="checkbox" style="display: none;" name="lang" value="javascript" autocomplete="off">Javascript
</label>
</div>
</div>
</div>
<div class="container">
<input type="submit" value="Search" class="btn btn-primary btn-lg btn-block" >
</div>
This is the PHP only showing off that I got the arrays:
<?php
print_r($_GET["lang"]);
?>
php html
php html
edited Nov 12 '18 at 12:17
Zeba
asked Nov 12 '18 at 9:46
ZebaZeba
227
227
The images should be shown at the same page or Is there a redirect to a new page? You can save the path in a variable in php and the use it in the html code <img src='<?php echo $path;?>'>
– q-jack
Nov 12 '18 at 9:50
Is there any code missing in your question, such as JavaScript? Your buttons are labels, so I am assuming you have some JavaScript to indicate which were clicked? Or is that the answer you are looking for? And you are in fact sending the entire array of data except for the ones you clicked? Either way, you must have some existing functionality regarding your buttons?
– Martin
Nov 12 '18 at 9:57
It is redirecting to a new page. There is no code missing, you can see which buttons are clicked because i added a bootstrap class
– Zeba
Nov 12 '18 at 10:12
add a comment |
The images should be shown at the same page or Is there a redirect to a new page? You can save the path in a variable in php and the use it in the html code <img src='<?php echo $path;?>'>
– q-jack
Nov 12 '18 at 9:50
Is there any code missing in your question, such as JavaScript? Your buttons are labels, so I am assuming you have some JavaScript to indicate which were clicked? Or is that the answer you are looking for? And you are in fact sending the entire array of data except for the ones you clicked? Either way, you must have some existing functionality regarding your buttons?
– Martin
Nov 12 '18 at 9:57
It is redirecting to a new page. There is no code missing, you can see which buttons are clicked because i added a bootstrap class
– Zeba
Nov 12 '18 at 10:12
The images should be shown at the same page or Is there a redirect to a new page? You can save the path in a variable in php and the use it in the html code <img src='<?php echo $path;?>'>
– q-jack
Nov 12 '18 at 9:50
The images should be shown at the same page or Is there a redirect to a new page? You can save the path in a variable in php and the use it in the html code <img src='<?php echo $path;?>'>
– q-jack
Nov 12 '18 at 9:50
Is there any code missing in your question, such as JavaScript? Your buttons are labels, so I am assuming you have some JavaScript to indicate which were clicked? Or is that the answer you are looking for? And you are in fact sending the entire array of data except for the ones you clicked? Either way, you must have some existing functionality regarding your buttons?
– Martin
Nov 12 '18 at 9:57
Is there any code missing in your question, such as JavaScript? Your buttons are labels, so I am assuming you have some JavaScript to indicate which were clicked? Or is that the answer you are looking for? And you are in fact sending the entire array of data except for the ones you clicked? Either way, you must have some existing functionality regarding your buttons?
– Martin
Nov 12 '18 at 9:57
It is redirecting to a new page. There is no code missing, you can see which buttons are clicked because i added a bootstrap class
– Zeba
Nov 12 '18 at 10:12
It is redirecting to a new page. There is no code missing, you can see which buttons are clicked because i added a bootstrap class
– Zeba
Nov 12 '18 at 10:12
add a comment |
2 Answers
2
active
oldest
votes
Remove style="display: none;"
so that checkbox are visible in the web page.Insert the name of your images in value attribute of the checkbox. When you will click on search button all the images selected in checkbox list will be displayed on the next web page.
Add following code to the programmer.php
<?php
$path_to_img_dir="path1/";
$arr=$_GET['lang'];
foreach($arr as $val){
echo sprintf("<img src='%s%s.jpg' /><br>",$path_to_img_dir,$val);
}
?>
I left the $path_to_img_dir empty and now its working TY
– Zeba
Nov 12 '18 at 12:16
add a comment |
You can save the path in a variable in php and the use it in the html code <img src='<?php echo $path;?>'>
Yeah, but how do show the right picture based on what html element is send?
– Zeba
Nov 12 '18 at 10:41
add a unique name to each checkbox. Only the checked ones are send. So you can check the request in php. Only the clicked one should be there. Like here in the example w3schools.com/tags/…
– q-jack
Nov 12 '18 at 11:04
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%2f53259482%2fhow-to-show-pictures-based-on-what-answer-filled-in-on-the-form%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Remove style="display: none;"
so that checkbox are visible in the web page.Insert the name of your images in value attribute of the checkbox. When you will click on search button all the images selected in checkbox list will be displayed on the next web page.
Add following code to the programmer.php
<?php
$path_to_img_dir="path1/";
$arr=$_GET['lang'];
foreach($arr as $val){
echo sprintf("<img src='%s%s.jpg' /><br>",$path_to_img_dir,$val);
}
?>
I left the $path_to_img_dir empty and now its working TY
– Zeba
Nov 12 '18 at 12:16
add a comment |
Remove style="display: none;"
so that checkbox are visible in the web page.Insert the name of your images in value attribute of the checkbox. When you will click on search button all the images selected in checkbox list will be displayed on the next web page.
Add following code to the programmer.php
<?php
$path_to_img_dir="path1/";
$arr=$_GET['lang'];
foreach($arr as $val){
echo sprintf("<img src='%s%s.jpg' /><br>",$path_to_img_dir,$val);
}
?>
I left the $path_to_img_dir empty and now its working TY
– Zeba
Nov 12 '18 at 12:16
add a comment |
Remove style="display: none;"
so that checkbox are visible in the web page.Insert the name of your images in value attribute of the checkbox. When you will click on search button all the images selected in checkbox list will be displayed on the next web page.
Add following code to the programmer.php
<?php
$path_to_img_dir="path1/";
$arr=$_GET['lang'];
foreach($arr as $val){
echo sprintf("<img src='%s%s.jpg' /><br>",$path_to_img_dir,$val);
}
?>
Remove style="display: none;"
so that checkbox are visible in the web page.Insert the name of your images in value attribute of the checkbox. When you will click on search button all the images selected in checkbox list will be displayed on the next web page.
Add following code to the programmer.php
<?php
$path_to_img_dir="path1/";
$arr=$_GET['lang'];
foreach($arr as $val){
echo sprintf("<img src='%s%s.jpg' /><br>",$path_to_img_dir,$val);
}
?>
edited Nov 12 '18 at 11:02
answered Nov 12 '18 at 10:48
Shivam AroraShivam Arora
15317
15317
I left the $path_to_img_dir empty and now its working TY
– Zeba
Nov 12 '18 at 12:16
add a comment |
I left the $path_to_img_dir empty and now its working TY
– Zeba
Nov 12 '18 at 12:16
I left the $path_to_img_dir empty and now its working TY
– Zeba
Nov 12 '18 at 12:16
I left the $path_to_img_dir empty and now its working TY
– Zeba
Nov 12 '18 at 12:16
add a comment |
You can save the path in a variable in php and the use it in the html code <img src='<?php echo $path;?>'>
Yeah, but how do show the right picture based on what html element is send?
– Zeba
Nov 12 '18 at 10:41
add a unique name to each checkbox. Only the checked ones are send. So you can check the request in php. Only the clicked one should be there. Like here in the example w3schools.com/tags/…
– q-jack
Nov 12 '18 at 11:04
add a comment |
You can save the path in a variable in php and the use it in the html code <img src='<?php echo $path;?>'>
Yeah, but how do show the right picture based on what html element is send?
– Zeba
Nov 12 '18 at 10:41
add a unique name to each checkbox. Only the checked ones are send. So you can check the request in php. Only the clicked one should be there. Like here in the example w3schools.com/tags/…
– q-jack
Nov 12 '18 at 11:04
add a comment |
You can save the path in a variable in php and the use it in the html code <img src='<?php echo $path;?>'>
You can save the path in a variable in php and the use it in the html code <img src='<?php echo $path;?>'>
answered Nov 12 '18 at 9:56
q-jackq-jack
94210
94210
Yeah, but how do show the right picture based on what html element is send?
– Zeba
Nov 12 '18 at 10:41
add a unique name to each checkbox. Only the checked ones are send. So you can check the request in php. Only the clicked one should be there. Like here in the example w3schools.com/tags/…
– q-jack
Nov 12 '18 at 11:04
add a comment |
Yeah, but how do show the right picture based on what html element is send?
– Zeba
Nov 12 '18 at 10:41
add a unique name to each checkbox. Only the checked ones are send. So you can check the request in php. Only the clicked one should be there. Like here in the example w3schools.com/tags/…
– q-jack
Nov 12 '18 at 11:04
Yeah, but how do show the right picture based on what html element is send?
– Zeba
Nov 12 '18 at 10:41
Yeah, but how do show the right picture based on what html element is send?
– Zeba
Nov 12 '18 at 10:41
add a unique name to each checkbox. Only the checked ones are send. So you can check the request in php. Only the clicked one should be there. Like here in the example w3schools.com/tags/…
– q-jack
Nov 12 '18 at 11:04
add a unique name to each checkbox. Only the checked ones are send. So you can check the request in php. Only the clicked one should be there. Like here in the example w3schools.com/tags/…
– q-jack
Nov 12 '18 at 11:04
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f53259482%2fhow-to-show-pictures-based-on-what-answer-filled-in-on-the-form%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
The images should be shown at the same page or Is there a redirect to a new page? You can save the path in a variable in php and the use it in the html code <img src='<?php echo $path;?>'>
– q-jack
Nov 12 '18 at 9:50
Is there any code missing in your question, such as JavaScript? Your buttons are labels, so I am assuming you have some JavaScript to indicate which were clicked? Or is that the answer you are looking for? And you are in fact sending the entire array of data except for the ones you clicked? Either way, you must have some existing functionality regarding your buttons?
– Martin
Nov 12 '18 at 9:57
It is redirecting to a new page. There is no code missing, you can see which buttons are clicked because i added a bootstrap class
– Zeba
Nov 12 '18 at 10:12