I have a upload image script and now I want update uploaded images in my database. I have used a php foreach loop and radio input for show each image and select which image is updated now my problem it's: when I select a radio bottom only send a random value with jquery to my php file but I want send only my selected radio value to my php file. My php loop is:
<?php foreach($images as $image) { ?>
<?php $src = JURI::base().'images/discount/'.$image['name']; ?>
<input type="radio" name="imgname" id="imgname" value="<?php echo $image['name'] ?>"><img src="<?php echo $src ?>" alt="" height="100" width="100" />
<?php } ?>
And this part of my jquery send radio value to my php file:
vpb_data.append('imgpath', $('#imgpath').val());