lundi 17 août 2015

Using html iframe and checkboxes to create a gallery

I am making a web based application, which has a back-end page in which images are loaded from a mysql db and displayed in an html iframe. I have also put in checkboxes to display after each image.

I need the person using the page to be able to use the checkboxes, to determine whether the image will display on the next iframe refresh. If the checkbox is ticked I want the image to still stay in the db/table, but not be displayed on the iframe refresh.

Currently this is the code which loads the images into the iframe:

<html>
<meta http-equiv="refresh" content="8">
<?php
//*Connect to database and set connection variables*
$dbconnection = mysql_select_db($dbname);
$query = "SELECT content,team_name,id FROM upload";
$result = mysql_query($query) or die('Error, query failed'.mysql_error());
while ($row = mysql_fetch_assoc($result))
{
        echo '<img width="200" height = "200" src="data:image/png;base64,' . base64_encode($row['content']) . ' " />';
        echo $row['team_name']."<input type='checkbox' name='CheckedBox'"; 
        if (isset($_POST['CheckedBox'])) 
        { 
                echo " value='checked'"; 
        } 
}
exit;
mysql_close();
?>
</html>

I am unsure of the best method to achieve what I want. Are there any better ways to do this? I am also unsure about how to proceed after I change the value to checked. Do I carry on by echoing more html or do I do the operations within php?

Thank you in advance. :))




Aucun commentaire:

Enregistrer un commentaire