display image next to radio button list problem

Reply

Join Date: Sep 2008
Posts: 2
Reputation: nea_m is an unknown quantity at this point 
Solved Threads: 0
nea_m nea_m is offline Offline
Newbie Poster

display image next to radio button list problem

 
0
  #1
Oct 16th, 2008
Hello all,
Im trying to display an image to the right side of radio buttons. I kind of did it, but my OK button is too low now, which means I must have put this echo code in the middle of the radio button list or something.

Im an absolute php newbie and Ive been tryig to resolve this for some time now, but I just dont see what Im doing wrong... Can anyone help, please? Im posting my code... Thanx in advance.

  1.  
  2. <?php
  3. if(isset($_REQUEST["submit"]));{
  4. $choice=$_REQUEST["choice"];
  5. echo "Voce koje ste izabrali: $choice";
  6. }
  7. $img=array("ananas"=>array("ananas","pineapple.jpg"), "jagode"=>array("jagode","strawberries.jpg"), "visnje"=>array("visnje","bcherries.jpg"), "lubenica"=>array("lubenica","watermelon.jpg"), "mandarine"=>array("mandarine","mandarines.jpg"), "limun"=>array("limun","lemon.jpg"), "mango"=>array("mango","mango.jpg"));
  8. ?>
  9.  
  10. <div class="b" align="left" style="padding-left:15px;">
  11.  
  12. <form name="vocnaforma" method="POST" >
  13. <b><i>Izaberite voce po zelji:</i></b>
  14. <br>
  15. <?php
  16. foreach($img as $k=>$v){
  17. echo "<input type='radio' name='choice' value='$k'";
  18. if($k==$choice){
  19. $imgsrc=$v[1];
  20. echo 'checked="checked"';
  21. }
  22. echo "> $v[0] <br/>";
  23. }
  24. echo "<table align='center'><tr><td><img src=$imgsrc height='95'></td></tr></table>";
  25. ?>
  26. <button name="submit" type="submit" > OK </n>
  27. </form>
  28.  
  29. </div>
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 93
Reputation: humbug is an unknown quantity at this point 
Solved Threads: 13
humbug's Avatar
humbug humbug is offline Offline
Junior Poster in Training

Re: display image next to radio button list problem

 
0
  #2
Oct 16th, 2008
Ok, first off, W3schools recommend you use <input type="submit" ... /> tags inside forms for consistency across browsers. http://www.w3schools.com/tags/tag_button.asp (And what's with the </n> tag?)

So what exactly are you trying to achieve? Do you want the image next to the checked radio button only or just to the right of the whole list? You usually get flamed down for using tables to try and arrange the page how you want it so best not to use it like you are. (This is really an html problem..)

I would suggest maybe using a table with two td's, one for the radio buttons (and maybe the ok button) and one for the image, if that's what your after.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 2
Reputation: nea_m is an unknown quantity at this point 
Solved Threads: 0
nea_m nea_m is offline Offline
Newbie Poster

Re: display image next to radio button list problem

 
0
  #3
Oct 16th, 2008
Hi,

Thanx for the reply. What Im trying to do is -display an image next to the whole radio button list, depending on what button is clicked. I will try your suggestin and will let you know if I succeeded. Cheers
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC