Re: Submit Using An Image Form Processing
| From: | Geoff Lane | Date: | Sat, 18 Jun 2011 16:18:35 +0000 |
| Subject: | Re: Submit Using An Image Form Processing | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-313601@lists.php.net to get a copy of this message | ||
On Saturday, June 18, 2011, Ron Piggott wrote:
> I am not getting anything. Is there a correct way of passing a
> variable through an image? The value in this above example is the
> auto_increment value of the product. From this I could remove the
> item from the shopping cart.
An image causes two variables (name_x and name_y) to be set where
these give the coordinates of the point on the image where the user
clicked. So, the corresponding x and y $_GET or $_POST variables will
be set and using your example, if you had:
<form action='adjust_cart.php' method='post'>
<INPUT TYPE="image" SRC="http://www.theverseoftheday.info/store-images/trash_can.png"
WIDTH="20" HEIGHT="20" style="float: right;border:0;"
alt="Remove Product From Shopping Cart" name="remove_product" />
</form>
Then in the called script, you could use:
if (isset($_POST['remove_product_x'])){
// do stuff to remove product from cart
}
HTH,
--
Geoff