I have page 1 which has 3 images. On the next page, there are 3 check boxes with the same id as the images. Roughly like this:
Page 1
[image1] [image2] [image3]
Page 2
[ ] Checkbox for image1
[ ] Checkbox for image2
[ ] Checkbox for image3
When I click on [image1] , I was hoping to auto-check the checkbox for image1 on page 2. How do I do this?
I tried to apply these codes but it didn't work. Where do I get it wrong? Any helpful suggestion is highly appreciated. Thanks!
php for Page 1:
<a href="page2.php?id=image1">image1</a>
<a href="page2.php?id=image2">image2</a>
<a href="page2.php?id=image3">image3</a>
Page2:
<input type="checkbox" name="checkbox" id="image1" <?php if($id == 'image1'){echo "checked";} ?> value="Image 1" /> Image 1
<input type="checkbox" name="checkbox" id="image2" <?php if($id == 'image2'){echo "checked";} ?> value="Image 2" /> Image 2
<input type="checkbox" name="checkbox" id="image3" <?php if($id == 'image3'){echo "checked";} ?> value="Image 3" /> Image 3
Aucun commentaire:
Enregistrer un commentaire