resimlere tıklamak yerine bir checkbox koydum umarım hocanız ödevde o kısmı şart koşmamıştır ve yardımıcı olabilmişimdir. iyi forumlar

<?php
if(isset($_COOKIE["urunler"])){
$urunler=$_COOKIE["urunler"];
$urunler_dizisi=explode(",",$urunler);
}
else $urunler="";

if($_POST)
{
     foreach($_POST['resim'] as $no)
{
$urunler=$urunler.",".$no;
        setcookie("urunler",$urunler,time()+3600);
}
}
if($urunler_dizisi){
for($i=1; $i<count($urunler_dizisi); $i++){
echo "ÜRÜN $i : <img src=".$urunler_dizisi[$i].".jpg><br>";}

}
else {echo "Sepetiniz Boş";}
?>

<form method="post" action="#">
<h1> Satışta Olan Ürünler</h1><br>
<input type="checkbox" name="resim[]" value="1"><img src="1.jpg" width="100px" height="100px">
<input type="checkbox" name="resim[]" value="2"><img src="2.jpg" width="100px" height="100px">
<input type="checkbox" name="resim[]" value="3"><img src="3.jpg" width="100px" height="100px">
<input type="checkbox" name="resim[]" value="4"><img src="4.jpg" width="100px" height="100px">
<input type="checkbox" name="resim[]" value="5"><img src="5.jpg" width="100px" height="100px"><br>
<input type="submit" value="sepetim">
</form>