I have a form that shows images whos paths are stored in mysql. The form has 'hide' and 'show' submit buttons for each image. Pressing the hide button should set the value of the 'status' field to 2 (hidden). But it does nothing, my queries don't seem to execute.
Here is the form
<form class="removeform"action='headerimageadd.php' method='post' enctype='multipart/form-data' name='image_remove_form' >
<?php
include '../inc/connect.php';
$q = "SELECT * FROM headerrotatorimage WHERE rotator = 1";
$result = $link->query($q);
while($row=mysqli_fetch_array($result)){
echo "<input type='submit' name='hide[{$row['id']}]' value='Hide'>",
"<input type='submit' name='show[{$row['id']}]' value='Show'>",
"<br />",
"<img src='{$row['filename']}' alt='{$row['name']}' />",
"<br />";
}
?>
</form>
And here is the php that is executed when the hide button is pressed.
<?php
if(isset($_POST['hide'])){
$chk = (array) $_POST['hide'];
$p = implode(',',array_keys($chk));
echo $p;
$t = 'SELECT * FROM headerrotatorimage WHERE id IN ($p)';
echo $t;
$s = 'UPDATE headerrotatorimage SET status = 2 WHERE id IN ($p)';
echo $s;
}
?>
Can anyone point out the problem??
Thanks