Lykos22 Posted September 6, 2012 Share Posted September 6, 2012 Hi, i'd like some help please. I have a gallery page that contains albums and i'd like to put to the album an image cover that can be updated anytime, but i'm not quite sure how to do that.In the admin area (shown in the image i uploaded) i have a page that displays in a do-while loop all images that belong to a specific album and in order to set the cover for the album i have to choose an image by clicking a radio button. <table width="100%" border="0" align="left" cellpadding="5" cellspacing="0" id="images"> <tr align="left"> <th>Inc. Id</th> <th>Image:</th> <th>Album Cover:</th> <th>Delete</th> </tr> <?php do{ ?> <tr> <td><?php echo $row_images['image_id']; ?></td> <td><img src="../_uploads/<?php echo $row_images['album_name']; ?>/<?php echo $row_images['image_name'].".".$row_images['image_ext']; ?>" width="150" /></td> <td><input type="radio" name="cover" value="<?php echo $row_images['image_id']; ?>" /></td> <td><input type="checkbox" name="del[]" value="<?php echo $row_images['image_id']; ?>" /></td> </tr> <?php }while($row_images = mysql_fetch_assoc($get_images)); ?> <tr> <td> </td> <td> </td> <td> </td> <td><input type="submit" name="submit" id="submit" value="Ok" /></td> </tr> </table> How can i do that? Link to comment Share on other sites More sharing options...
niche Posted September 6, 2012 Share Posted September 6, 2012 Use your buttons to select/deselect an image, send that request to your script (if the album covers where hard coded you won't need sql), and display. Viola! BTW, put your requests in a form. Link to comment Share on other sites More sharing options...
birbal Posted September 6, 2012 Share Posted September 6, 2012 (edited) I don't know how is your image and album scheme had been set in your database. you can have album table and image table seperately. in album table put a colum for coverPhoto which will hold a reference id of image which will store the id of a image. images table will hold the album reference. When you fetch out images by its albums you can choose a particular image id and sumbit the form. when you submit the form you will insert the image id in album's "coverPhoto" column. Edited September 6, 2012 by birbal Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now