From: "Hardik Doshi" <[EMAIL PROTECTED]>
> I have a page on which there are multiple image
> buttons. Is there any way to determine which button is
> pressed by the user?
>
> For example, there is a page on which i display all
> the users of the system with the edit and delete
> button beside each user entry. Now if admin wants to
> delete one of the users then how can i know admin
> pressed which button? It is possible with non-image
> button but image button always give me x and y
> co-ordinates.
>
> Please let me know if you have any clue.
Use a method like this:
<html>
<form method="POST" action="test.php">
<input type="image" src="image.gif" name="image[1]">
<input type="image" src="image.gif" name="image[2]">
<input type="image" src="image.gif" name="image[3]">
<input type="image" src="image.gif" name="image[4]">
</form>
</html>
<?php
if(isset($_POST['image']))
{
$button = each($_POST['image']);
//$button['key'] will contain the number
//of the button that was clicked on
echo "You pressed button {$button['key']}";
}
?>
Where the number in image[XX] will user_id of the user you want to edit or
delete.
---John Holmes...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php