I'm writing a website in which there is a galery of photos. Under every photo there is a form with a single checkbox, so i can check it and it should stay checked during the session. The problem is that nothing that I wrote was working and every time I checked the checkbox and hit submit, it keeps unchecking. Here is my form:
<?= $i = 0; ?>
<?php if (count($photos)): ?>
<?php foreach ($photos as $photo): ?>
<?= $checkbox['_id'] = $photo['_id']; ?>
<div class="gallery">
<a target="_blank" href="view?id=<?= $photo['_id'] ?>">
<img src="images/<?=$photo['title']."_min.".$photo['extension']?>" alt="Toster" >
</a>
<div class="desc">Tytuł: <?=$photo['title'] ?> </div>
<div class="desc">Autor: <?=$photo['author'] ?></div>
<div class="desc"><a href="delete?id=<?= $photo['_id'] ?>">Delete</a></div>
<div class="desc">
<form action="remember_ses" method="post">
<input type="checkbox" name="checkbox[<?=$i ?>]" value="wybrane" ><?= $photo['_id'] ?>
<input type="hidden" name="id" value="<?=$checkbox['_id']; ?>">
<input type="submit" value="Remember" id="submit">
</form>
</div>
</div>
<?=$i=$i + 1; ?>
<?php endforeach ?>
Aucun commentaire:
Enregistrer un commentaire