christyk Posted March 23, 2010 Share Posted March 23, 2010 I am very new to PHP, have been reading tutorials on line and I have figured out how to partially do what I am trying to do.... Im using a form so the visitor to the site can choose a selection on two drop down menus. Depending on the combination of choices they will get a different response in a frame below. Right now I have it so that text shows up in relation to their choices but what I want is for a specific image to show up depending upon their two selections. I am just not sure even how to search for this question, can anyone give me a clue of where to look or what this would involve? Here is a link to what I have created so far (not all the drop down combos are set up yet) http://www.christykarpinski.com/simcam/form.php Thanks! Link to comment https://forums.phpfreaks.com/topic/196269-can-you-make-an-image-post-from-input-into-a-form-instead-of-text/ Share on other sites More sharing options...
-Karl- Posted March 23, 2010 Share Posted March 23, 2010 It is possible to do it, pretty simple in fact. If you show me the code you have so far, I'll take a look at it. Link to comment https://forums.phpfreaks.com/topic/196269-can-you-make-an-image-post-from-input-into-a-form-instead-of-text/#findComment-1030689 Share on other sites More sharing options...
MatthewJ Posted March 23, 2010 Share Posted March 23, 2010 As Karl suggested, you should post the code, but not for the form, for imageframe.php instead. That is where you're writing out the data to be displayed. Link to comment https://forums.phpfreaks.com/topic/196269-can-you-make-an-image-post-from-input-into-a-form-instead-of-text/#findComment-1030694 Share on other sites More sharing options...
litebearer Posted March 23, 2010 Share Posted March 23, 2010 Couple of ways come to mind - using Switch or using an array rough psuedo code idea using Switch Menu 1 Menu 2 A A B B C C $display = menu1 . menu2 switch ($display){ case "AA": echo "<IMG SRC='aa.jpg'>"; break; case "AB": echo "<IMG SRC='ab.jpg'>"; break; case "AC": echo "<IMG SRC='ac.jpg'>"; break; case "BA": echo "<IMG SRC='ba.jpg'>"; break; case "BB": echo "<IMG SRC='bb.jpg'>"; break; case "BC": echo "<IMG SRC='bc.jpg'>"; break; case "CA": echo "<IMG SRC='ca.jpg'>"; break; case "CB": echo "<IMG SRC='cb.jpg'>"; break; case "CC": echo "<IMG SRC='cc.jpg'>"; break; } Link to comment https://forums.phpfreaks.com/topic/196269-can-you-make-an-image-post-from-input-into-a-form-instead-of-text/#findComment-1030695 Share on other sites More sharing options...
christyk Posted March 23, 2010 Author Share Posted March 23, 2010 code for the imageframe.php <html> <head></head> <body> <html> <body> <?php // get form selection $day = $_GET['day']; // check value and select appropriate item if ($aperture == 2 && $shutter == 2) { $special = 'f 2.8 at 1/2 second'; } elseif ($aperture == 4 && $shutter == 2) { $special = 'f 4 at 1/2 second'; } elseif ($aperture == 5 && $shutter == 2) { $special = 'f 5.6 at 1/2 second'; } else { $special = 'begining exposure image'; } ?> <h2>Your exposure is:</h2> <?php echo $special; ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/196269-can-you-make-an-image-post-from-input-into-a-form-instead-of-text/#findComment-1030697 Share on other sites More sharing options...
-Karl- Posted March 23, 2010 Share Posted March 23, 2010 <html> <head></head> <body> <html> <body> <h2>Your exposure is:</h2> <?php // get form selection $day = $_GET['day']; // check value and select appropriate item if ($aperture == 2 && $shutter == 2) { echo "<IMG SRC='22.png'>"; } elseif ($aperture == 4 && $shutter == 2) { echo "<IMG SRC='42.png'>"; } elseif ($aperture == 5 && $shutter == 2) { echo "<IMG SRC='52.png'>"; } else { echo "begining exposure image"; } ?> </body> </html> Or you can do as litebearer stated. Link to comment https://forums.phpfreaks.com/topic/196269-can-you-make-an-image-post-from-input-into-a-form-instead-of-text/#findComment-1030699 Share on other sites More sharing options...
christyk Posted March 23, 2010 Author Share Posted March 23, 2010 Great! thank you so much! Link to comment https://forums.phpfreaks.com/topic/196269-can-you-make-an-image-post-from-input-into-a-form-instead-of-text/#findComment-1030701 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.