Change an image src with radio buttons
Posted: Sun May 08, 2011 8:37 pm
Hmm...
I have a second option, but it's javascript related. But let's say I have something like this,
I have a second option, but it's javascript related. But let's say I have something like this,
<?php
$images = glob('templates450/*.{jpg,jpeg,png,JPG,JPEG,PNG}', GLOB_BRACE);
foreach($images as $image){
?>
<p><input type="radio" name="img" class="radio" value="<?php echo $image; ?>" />
<img src="<?php echo "{$image}"; ?>" alt="<?php echo $image; ?>" /></p>
<?php
}
?>
do you know how to when a radio box is selected it echoes out the right image? I did Google around but since my javascript knowledge is very, very, very poor I don't know if I actually found what I wanted.