shocker-z Posted April 3, 2006 Share Posted April 3, 2006 How can i make it so then when a user clicks on pic 1 text string it will selct the radio button next to it? I'm going to change this to an image instead of text but thought i would keep it simple :)[code] <label> <input type="radio" name="RadioGroup1" value="1"> Pic 1 </label> <br> <label> <input type="radio" name="RadioGroup1" value="2"> Pic 2</label> <br>[/code]think im loosing it up top lolThanks in advance,Liam Link to comment https://forums.phpfreaks.com/topic/6514-radio-button-grouped-with-text/ Share on other sites More sharing options...
shocker-z Posted April 3, 2006 Author Share Posted April 3, 2006 Ok i've done this using<input type="radio" name="sample" id="one" accesskey="1" checked> <label for="one">One</label>I now have a problem that when clicking the image it doesnlt select the box as well as setting the main image to the one selected see here [a href=\"http://blucode.sytes.net/ukchat/index.php\" target=\"_blank\"]http://blucode.sytes.net/ukchat/index.php[/a] login detailsUsername: shocker-zPassword: [blank]by blank i mean totaly blank! :)Here is all the code i'm using[code]<? if ($_SESSION['logged_in']) {?><script language="javascript">function switch1(div) {if (document.getElementById('1')) {var option=['1','2','3'];for(var i=0; i<option.length; i++) { obj=document.getElementById(option[i]);obj.style.display=(option[i]==div)? "block" : "none"; }}}//function switchImg(i){document.images["wine"].src = i;}</script><table width="450" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="300" align="left" valign="top"><p class="fright"><img src="profiles/nopic.gif" id="wine" height="300" width="300" alt="" /></p></td> <td width="150" valign="top"><div class="fright"></div> <div align="center"> <?php$img_query=mysql_query("SELECT username,ID,description FROM images WHERE username='$session_username' LIMIT 3");$i=0;while ($img=mysql_fetch_array($img_query)) {$i++;if ($img) {$id=$img['ID'];$cat2=$cat.'/';?> </div> <hr align="center" /> <div align="center"> <input type="radio" name="del_picture" id="<?php echo $id; ?>" accesskey="<?php echo $id; ?>" checked> <label for="<?php echo $id; ?>">pic <?php echo $id; ?> <img src="<?php echo($cat2.'thumbs.php?id='.$id); ?>" onclick="switchImg('<?php echo($cat2.'view.php?id='.$id); ?>')" checked="checked" /></label> </div> <hr align="center" /> <div align="center"> <?php} else { echo('no image');}$i++;}?> </div> </div></td> </tr></table><p> <label></label> <?php} else { if (!$_SESSION['logged_in']) { echo("You are not logged in!"); }}?></p>[/code]RegardsLiam Link to comment https://forums.phpfreaks.com/topic/6514-radio-button-grouped-with-text/#findComment-23620 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.