I have a one form and onclick i want to remove image id from array without page refresh and after submit form i will update it in the DB.
I am using following code for this but no any success.
PHP Code:-
$total = count($oldimage);
//print_r($oldimage);
for($i=0;$i<$total;$i++)
{
$fimgsql="select * from cc_tbl_img_vid_upload where id='$oldimage[$i]'";
$gimgname=mysqli_query($db,$fimgsql) or die('Error');
$rw=mysqli_fetch_assoc($gimgname);
?><b id="rm<?=$i?>">Remove<?=$rw['upload_url']?></b><br/><br/>
<script>$( "#rm<?=$i?>" ).click(function() {
<?php unset($oldimage[$i]);?>
alert(<?php echo $oldimage[$i]; ?>);
$( "#rm<?=$i?>" ).hide();
});</script>
<?php
}
sort($oldimage);
$oldimage=implode(',',$oldimage);