How to show pictures based on what answer filled in on the form?












2














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"]);
?>









share|improve this question
























  • 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
















2














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"]);
?>









share|improve this question
























  • 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














2












2








2


0





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"]);
?>









share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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


















  • 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












2 Answers
2






active

oldest

votes


















1














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);
}
?>





share|improve this answer























  • I left the $path_to_img_dir empty and now its working TY
    – Zeba
    Nov 12 '18 at 12:16



















0














You can save the path in a variable in php and the use it in the html code <img src='<?php echo $path;?>'>






share|improve this answer





















  • 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











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%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









1














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);
}
?>





share|improve this answer























  • I left the $path_to_img_dir empty and now its working TY
    – Zeba
    Nov 12 '18 at 12:16
















1














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);
}
?>





share|improve this answer























  • I left the $path_to_img_dir empty and now its working TY
    – Zeba
    Nov 12 '18 at 12:16














1












1








1






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);
}
?>





share|improve this answer














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);
}
?>






share|improve this answer














share|improve this answer



share|improve this answer








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


















  • 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













0














You can save the path in a variable in php and the use it in the html code <img src='<?php echo $path;?>'>






share|improve this answer





















  • 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
















0














You can save the path in a variable in php and the use it in the html code <img src='<?php echo $path;?>'>






share|improve this answer





















  • 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














0












0








0






You can save the path in a variable in php and the use it in the html code <img src='<?php echo $path;?>'>






share|improve this answer












You can save the path in a variable in php and the use it in the html code <img src='<?php echo $path;?>'>







share|improve this answer












share|improve this answer



share|improve this answer










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


















  • 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


















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.





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.




draft saved


draft discarded














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





















































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

Full-time equivalent

さくらももこ

13 indicted, 8 arrested in Calif. drug cartel investigation