Hi all
I hope someone can help me with this small but annoying problem.
I have search for help, but was not able to find any on this issue.
On a page I have a list with a checkbox in front of each line there the user can select multiple and then click either a approve button or a decline button.
the list:
<form action="?mode=admin_images" method="post">
<table class="admin_images">
<tr>
<td style="text-align:center">
<input type="checkbox" id="check_13" name="check[]" value="6524"/>
</td>
<td>
<a href="#" onclick="popup('popup.php?mode=profile&id=1476',800,600,'popup');"></a>
</td>
<td>
<a href="#" onclick="previewImage('/pics/bild2.jpg',351,368);">/pics/bild2.jpg<span class="popup"><span style="font-weight:bold;text-decoration:underline;">Reason:</span><br /></span></a><!--[if IE]>
<div><span class="title">Reason:</span><br /></div><![endif]-->
</td>
<td style="text-align:center">19,99 KB</td>
<td style="text-align:center">3</td>
<td style="text-align:center">2005-02-25 23:47:03</td>
<td style="text-align:center"></td>
<td style="text-align:center">
<a href="?mode=admin_images&accept_img=6524"><img src="img/button_green1.png" alt="ok" style="border:none" /></a>
</td>
<td style="text-align:center">
<a href="?mode=admin_images&decline_img=6524"><img src="img/button_red.png" alt="ok" style="border:none" /></a>
</td>
</tr>
<tr>
<td style="text-align:center">
<input type="checkbox" id="check_14" name="check[]" value="6525"/>
</td>
<td>
<a href="#" onclick="popup('popup.php?mode=profile&id=1476',800,600,'popup');"></a>
</td>
<td>
<a href="#" onclick="previewImage('/pics/bild3.jpg',176,420);">/pics/bild3.jpg<span class="popup"><span style="font-weight:bold;text-decoration:underline;">Reason:</span><br /></span></a><!--[if IE]>
<div><span class="title">Reason:</span><br /></div><![endif]-->
</td>
<td style="text-align:center">9,17 KB</td>
<td style="text-align:center">3</td>
<td style="text-align:center">2005-02-25 23:49:39</td>
<td style="text-align:center"></td>
<td style="text-align:center">
<a href="?mode=admin_images&accept_img=6525"><img src="img/button_green1.png" alt="ok" style="border:none" /></a>
</td>
<td style="text-align:center"><a href="?mode=admin_images&decline_img=6525"><img src="img/button_red.png" alt="ok" style="border:none" /></a>
</td>
</tr>
</table>
</form>
the buttons:
<button type="submit" id="accept_img" name="accept_img" value="1" title="Accept selected images" class="submit">
<img src="img/button_green1.png" alt="Accept">
</button>
<button type="submit" id="decline_img" name="decline_img" value="0" title="Decline selected images" class="submit">
<img src="img/button_red.png" alt="Decline">
</button>
The issue:
Then the page i submitted i want to check whether the user clicked accept or decline.
I have the following script that should do that but doesn't.
It always executes the first foreach.
<?
if (isset($_POST['accept_img'])) {
foreach ($_POST['check'] as $id) {
$img = new Image($id);
$_SESSION['DELETEIMAGE'] = $_POST['accept_img'];
$_SESSION['DELETEIMAGE'] .= "POST_ACCEPT";
$img->status = 1;
$img->save();
}
ob_clean();
if (isset($_POST['query_string'])) header("Location: ?$_POST[query_string]");
else header("Location: ?mode=admin_images&status=0");
ob_end_flush();
exit;
}
elseif (isset($_POST['decline_img'])) {
foreach ($_POST['check'] as $id) {
$img = new Image($id);
$_SESSION['DELETEIMAGE'] = $_POST['decline_img'];
$_SESSION['DELETEIMAGE'] .= "POST_DECLINE";
$img->delete();
$img->save();
}
ob_clean();
if (isset($_POST['query_string'])) header("Location: ?$_POST[query_string]");
else header("Location: ?mode=admin_images&status=0");
ob_end_flush();
exit;
}
?>
I'm looking forward to some tips on how to deal with this problem.
Thanks
/Peter Larsen
I hope someone can help me with this small but annoying problem.
I have search for help, but was not able to find any on this issue.
On a page I have a list with a checkbox in front of each line there the user can select multiple and then click either a approve button or a decline button.
the list:
<form action="?mode=admin_images" method="post">
<table class="admin_images">
<tr>
<td style="text-align:center">
<input type="checkbox" id="check_13" name="check[]" value="6524"/>
</td>
<td>
<a href="#" onclick="popup('popup.php?mode=profile&id=1476',800,600,'popup');"></a>
</td>
<td>
<a href="#" onclick="previewImage('/pics/bild2.jpg',351,368);">/pics/bild2.jpg<span class="popup"><span style="font-weight:bold;text-decoration:underline;">Reason:</span><br /></span></a><!--[if IE]>
<div><span class="title">Reason:</span><br /></div><![endif]-->
</td>
<td style="text-align:center">19,99 KB</td>
<td style="text-align:center">3</td>
<td style="text-align:center">2005-02-25 23:47:03</td>
<td style="text-align:center"></td>
<td style="text-align:center">
<a href="?mode=admin_images&accept_img=6524"><img src="img/button_green1.png" alt="ok" style="border:none" /></a>
</td>
<td style="text-align:center">
<a href="?mode=admin_images&decline_img=6524"><img src="img/button_red.png" alt="ok" style="border:none" /></a>
</td>
</tr>
<tr>
<td style="text-align:center">
<input type="checkbox" id="check_14" name="check[]" value="6525"/>
</td>
<td>
<a href="#" onclick="popup('popup.php?mode=profile&id=1476',800,600,'popup');"></a>
</td>
<td>
<a href="#" onclick="previewImage('/pics/bild3.jpg',176,420);">/pics/bild3.jpg<span class="popup"><span style="font-weight:bold;text-decoration:underline;">Reason:</span><br /></span></a><!--[if IE]>
<div><span class="title">Reason:</span><br /></div><![endif]-->
</td>
<td style="text-align:center">9,17 KB</td>
<td style="text-align:center">3</td>
<td style="text-align:center">2005-02-25 23:49:39</td>
<td style="text-align:center"></td>
<td style="text-align:center">
<a href="?mode=admin_images&accept_img=6525"><img src="img/button_green1.png" alt="ok" style="border:none" /></a>
</td>
<td style="text-align:center"><a href="?mode=admin_images&decline_img=6525"><img src="img/button_red.png" alt="ok" style="border:none" /></a>
</td>
</tr>
</table>
</form>
the buttons:
<button type="submit" id="accept_img" name="accept_img" value="1" title="Accept selected images" class="submit">
<img src="img/button_green1.png" alt="Accept">
</button>
<button type="submit" id="decline_img" name="decline_img" value="0" title="Decline selected images" class="submit">
<img src="img/button_red.png" alt="Decline">
</button>
The issue:
Then the page i submitted i want to check whether the user clicked accept or decline.
I have the following script that should do that but doesn't.
It always executes the first foreach.
<?
if (isset($_POST['accept_img'])) {
foreach ($_POST['check'] as $id) {
$img = new Image($id);
$_SESSION['DELETEIMAGE'] = $_POST['accept_img'];
$_SESSION['DELETEIMAGE'] .= "POST_ACCEPT";
$img->status = 1;
$img->save();
}
ob_clean();
if (isset($_POST['query_string'])) header("Location: ?$_POST[query_string]");
else header("Location: ?mode=admin_images&status=0");
ob_end_flush();
exit;
}
elseif (isset($_POST['decline_img'])) {
foreach ($_POST['check'] as $id) {
$img = new Image($id);
$_SESSION['DELETEIMAGE'] = $_POST['decline_img'];
$_SESSION['DELETEIMAGE'] .= "POST_DECLINE";
$img->delete();
$img->save();
}
ob_clean();
if (isset($_POST['query_string'])) header("Location: ?$_POST[query_string]");
else header("Location: ?mode=admin_images&status=0");
ob_end_flush();
exit;
}
?>
I'm looking forward to some tips on how to deal with this problem.
Thanks
/Peter Larsen