Re: [PHP] Submit Using An Image Form Processing

2011-06-19 Thread Shawn McKenzie
On 06/19/2011 07:26 AM, tedd wrote:
> At 6:34 PM -0500 6/18/11, Shawn McKenzie wrote:
>>
>> Get method is for retrieval only.  It is not for anything that has a
>> consequence (insert, update, delete, send email, etc.).  Use only post
>> for those.
>>
>> -- 
>> Thanks!
>> -Shawn
> 
> 
> Why?
> 
> Cheers,
> 
> tedd
> 

The convention has been established that the GET and HEAD methods SHOULD
NOT have the significance of taking an action other than retrieval.
These methods ought to be considered "safe". This allows user agents to
represent other methods, such as POST, PUT and DELETE, in a special way,
so that the user is made aware of the fact that a possibly unsafe action
is being requested.

http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Submit Using An Image Form Processing

2011-06-19 Thread Jason Pruim
On Jun 18, 2011, at 7:34 PM, Shawn McKenzie wrote:

> On 06/18/2011 11:06 AM, Jason Pruim wrote:
>> 
>> On Jun 18, 2011, at 11:54 AM, "Ron Piggott"  
>> wrote:
>> 
>>> >> SRC="http://www.theverseoftheday.info/store-images/trash_can.png"; 
>>> WIDTH="20"  HEIGHT="20" style="float: right;boarder: 0;" alt="Remove 
>>> Product From Shopping Cart" name="remove_product" value="1" />
>> 
>> I would wrap the image in a link like so:
>> 
>> 
>> And then have a get look for that variable:
>> 
>> $id=$_get[id];
>> 
>> If (isset($id)) {
>> 
>> //delete code here
>> }
>> 
>> Check all that before you run it I'm writing from my smart phone and 
>> it's all untested. Hopefully it gives you a start though. 
>> 
>> Jason Pruim 
> 
> Get method is for retrieval only.  It is not for anything that has a
> consequence (insert, update, delete, send email, etc.).  Use only post
> for those.

I've actually used $_GET in the way I described because then it doesn't require 
submitting a form to be able to delete something from a list.

with $_POST you would have to submit the form, so you would need to build an 
array of check boxes to store what ones you want to delete, and then go through 
and process the array to remove all the proper items.

But with the $_GET you can process it one at a time. I had a system up and 
working for maintaining a address database for quite awhile and it worked great 
for me.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Submit Using An Image Form Processing

2011-06-19 Thread tedd

At 11:54 AM -0400 6/18/11, Ron Piggott wrote:
I am writing a shopping cart using the PayPal API.  Shopping cart 
works.  Just adding additional functionality. 

From the shopping cart contents I am trying to make it so the user 
may click on a picture of a trash can to delete the item.  I wrote 
the following line of code:


SRC="http://www.theverseoftheday.info/store-images/trash_can.png"; 
WIDTH="20"  HEIGHT="20" style="float: right;boarder: 0;" alt="Remove 
Product From Shopping Cart" name="remove_product" value="1" />


But when I have do:

echo $remove_product;

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. 


OR

Is there a better way to pass a variable through a graphic?  I am 
hoping for the shopping cart contents to be just 1 form where users 
will have several options (change quantities, delete specific 
items).  I can't use a hidden field. 


Thank you for your help.

Ron


Ron:

You don't need to pass a value. What you need is simply a trigger to 
do something. As such, you can use lot's of things.


In this case, a button should work.

http://www.htmlcodetutorial.com/forms/_BUTTON.html

However, I would take all the styling (including dimensions) out of 
it and place those in a css sheet.


Also, what's wrong with a hidden field?

Cheers,

tedd

--
---
http://sperling.com/

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



Re: [PHP] Submit Using An Image Form Processing

2011-06-19 Thread Ashley Sheridan


tedd  wrote:

>At 6:34 PM -0500 6/18/11, Shawn McKenzie wrote:
>>
>>Get method is for retrieval only.  It is not for anything that has a
>>consequence (insert, update, delete, send email, etc.).  Use only post
>>for those.
>>
>>--
>>Thanks!
>>-Shawn
>
>
>Why?
>
>Cheers,
>
>tedd
>
>--
>---
>http://sperling.com/
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

That's just the http spec. It's because browsers and servers know how to 
correctly handle the different types of connections.

Some browsers make multiple connections for get, which is one of the main 
reasons for people having problems with multiple hits on a page being 
registered when only one was expected.

Ashley Sheridan
http://www.ashleysheridan.co.uk
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

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



Re: [PHP] Submit Using An Image Form Processing

2011-06-19 Thread tedd

At 6:34 PM -0500 6/18/11, Shawn McKenzie wrote:


Get method is for retrieval only.  It is not for anything that has a
consequence (insert, update, delete, send email, etc.).  Use only post
for those.

--
Thanks!
-Shawn



Why?

Cheers,

tedd

--
---
http://sperling.com/

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