I have image slider showing images which user uploaded. Every user has to uploaded at least 1 image and upto 4 as his interest. Uploading image 1 is compulsory. Rest which user didn't upload save as no_image.jpg file.
If someone upload 1 image, it repeats image1 2 times. it works fine and the way it's showing is ok. Problem is if someone upload 2 or 3 image, it repeats some images 2 times. It's bit odd.
I don't know much about coding. Please someone help me to solve this issue and work this perfectly. Your help is highly appreciated.
Edited: image1 code is not displaying in here properly. I don't know issue. it is just shows image1. No if loop there.
<div class="product" >
<div class="thumbnail"><img src="<?php echo site_url(); ?>assets/images/adsimages/<?php
                                        $a = 'no_image.jpg';
                                        $b = $post['image2'];
                                        $c = $post['image3'];
                                        $d = $post['image4'];
                                        if ($b != $a) {
                                            echo $post['image2'];
                                        } elseif ($c != $a){
                                            echo $post['image3'];
                                        }elseif ($d != $a){
                                            echo $post['image4'];
                                        }else echo $post['image1']
                                        ?>" ></div>
</div>
<div class="product" >
<div class="thumbnail"><img src="<?php echo site_url(); ?>assets/images/adsimages/<?php
                                        $a = 'no_image.jpg';
                                        $c = $post['image3'];
                                        $d = $post['image4'];
                                        if ($c != $a){
                                            echo $post['image3'];
                                        }elseif ($d != $a){
                                            echo $post['image4'];
                                        }else echo $post['image1']
                                        ?>" ></div>
 </div>
 <div class="product" >
 <div class="thumbnail"><img src="<?php echo site_url(); ?>assets/images/adsimages/<?php
                                        $a = 'no_image.jpg';
                                        $d = $post['image4'];
                                            if ($d != $a){
                                            echo $post['image4'];
                                        }else echo $post['image1']
                                        ?>"></div>
                                </div>