javascript - send radio input value with jquery to php file -
i have upload image script , want update uploaded images in database. have used php foreach loop , radio input show each image , select image updated problem it's: when select radio bottom send random value jquery php file want send selected radio value php file. php loop is:
<?php foreach($images $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 part of jquery send radio value php file:
vpb_data.append('imgpath', $('#imgpath').val());
try -
$(function(){ $("#imgpath").on('click',function(){ var value = $(this).val(); vpb_data.append('imgpath', value); }); });
Comments
Post a Comment