Checkbox problem
| From: | Kit Kerbel | Date: | Wed, 21 Aug 2002 14:40:39 +0000 |
| Subject: | Checkbox problem | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-15413@lists.php.net to get a copy of this message | ||
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