| | |
display image next to radio button list problem
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Sep 2008
Posts: 2
Reputation:
Solved Threads: 0
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.
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.
PHP Syntax (Toggle Plain Text)
<?php if(isset($_REQUEST["submit"]));{ $choice=$_REQUEST["choice"]; echo "Voce koje ste izabrali: $choice"; } $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")); ?> <div class="b" align="left" style="padding-left:15px;"> <form name="vocnaforma" method="POST" > <b><i>Izaberite voce po zelji:</i></b> <br> <?php foreach($img as $k=>$v){ echo "<input type='radio' name='choice' value='$k'"; if($k==$choice){ $imgsrc=$v[1]; echo 'checked="checked"'; } echo "> $v[0] <br/>"; } echo "<table align='center'><tr><td><img src=$imgsrc height='95'></td></tr></table>"; ?> <button name="submit" type="submit" > OK </n> </form> </div>
Ok, first off, W3schools recommend you use
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.
<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.
![]() |
Similar Threads
- I have an internet connection but cannot access web pages!!! HELP!!! (Web Browsers)
- popups in Firefox, IE (w/l2mfix, hjt logs) (Viruses, Spyware and other Nasties)
- Can't delete virus (Viruses, Spyware and other Nasties)
- more "home search assistent" fun... (Viruses, Spyware and other Nasties)
Other Threads in the PHP Forum
- Previous Thread: HTTP request with negotiate authorization
- Next Thread: php form mail inside the flash
| Thread Tools | Search this Thread |
apache api array basic beginner body broken cache cakephp class cms code computing confirm cron curl customizableitems database date date/time delete dynamic email error file filter folder form forms forum freelancing function functions gc_maxlifetime google header headmethod howtowriteathesis href htaccess html iframe image include ip javascript joomla limit link list login malfunction memmory memory menu mod_rewrite msqli_multi_query multiple mycodeisbad mysql navigation neutrality oop parameter parsing paypal pdf php phpmysql query question random recourse regex root script search select seo server sessions snippet source space sql static system table thesishelp trouble tutorial update upload url variable video web webdesign xml youtube





