RE: [PHP-WIN] Checkbox problem
| From: | Rich Gray | Date: | Wed, 21 Aug 2002 15:22:33 +0000 |
| Subject: | RE: [PHP-WIN] Checkbox problem | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-15419@lists.php.net to get a copy of this message | ||
Can you not give the buttons different names and test $_POST['buttonname']
in the next script?
e.g.
1.php
===
<input type="submit" name="delete" value="Delete!"
title="Click to delete">
<input type="submit" name="amend" value="Amend!" title="Click
to amend">
2.php
====
if (isset($_POST['delete'])) {
// Do deletes
}
if (isset($_POST['amend'])) {
// Do amends
}
etc etc
-----Original Message-----
From: Kit Kerbel [mailto:kerbel5@hotmail.com]
Sent: 21 August 2002 15:41
To: php-windows@lists.php.net
Subject: [PHP-WIN] Checkbox problem
I have a page that lists entries made by users in the database. There are
three types of entries. Each type of entry is stored in their own table.
My problem is this: I want people to be able to click a checkbox next to
any of the entries and press a delete button and delete those entries. The
only hang up is that the delete button works as a submit button and sends
the checkbox arrays as post variables to the next page and I'm trying to
figure out a way to send another post variable when you click delete.
something like my_listings?delete=true.
not sure how, or if you can even do this with a submit button. I also have
three other buttons on this page that do different things when pressed to
the boxes checked. I tried using
onclick="<?$_SESSION["delete"]="true";?>" in the delete(submit)
button but
for some reason, this session variable is also set when I click the other
buttons as well, I guess because they are submit buttons too? If you can
make sense of any of this, maybe you can help.
Thanx in advance,
Kit
//this is what I do if the variable is set
// **Marking Listings as Deleted
if($_SESSION["delete"]=="true")
{
if(isset($_REQUEST["horse"]))
{
foreach($_REQUEST["horse"] as $value)
{
odbc_exec($connection, "UPDATE tblHorse SET dDeleted = 1 where dHorseID =
'".$value."'");
}
}
if(isset($_REQUEST["trailer"]))
{
foreach($_REQUEST["trailer"] as $value)
{
odbc_exec($connection, "UPDATE tblTrailer SET dDeleted = 1 where
dTrailerID = '".$value."'");
}
}
if(isset($_REQUEST["tack"]))
{
foreach($_REQUEST["tack"] as $value)
{
odbc_exec($connection, "UPDATE tblTack SET dDeleted = 1 where dTackID =
'".$value."'");
}
}
}
unset($_SESSION["method"]);
//This is how i'm trying to set the variable
<input type="image" src="images/button_activate.gif" width="114"
height="19"
border="0" >
<input type="image" src="images/button_sold.gif" width="114"
height="19"
border="0" >
<input type="image" src="images/button_renew.gif" width="114"
height="19"
border="0" >
<input type="image" src="images/button_delete.gif" width="114"
height="19"
border="0"
onclick="<?$_SESSION["delete"]="true";?>"></td>
_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php