Re: Submit Using An Image Form Processing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux