----- Original Message -----
From: <admin@happyparkingspace.com>
To: "Gareth" <device@paradise.net.nz>
Sent: Wednesday, December 08, 2004 2:11 PM
Subject: Ignore last two posts!
quoted 97 lines sorry, I was fowarding these from one account to another (a long story),> sorry, I was fowarding these from one account to another (a long story),
> must have accidently sent them to the list?...
>
> Gareth
>
>
> ----- Original Message -----
> From: "Gareth" <device@paradise.net.nz>
> To: <admin@happyparkingspace.com>
> Sent: Wednesday, December 08, 2004 1:52 PM
> Subject: [Fwd: [phpug] Increasing/Decreasing Array Value Using Form]
>
>
>>
>>
>> -------- Original Message --------
>> Subject: [phpug] Increasing/Decreasing Array Value Using Form
>> Date: Sun, 14 Nov 2004 17:19:41 +1300
>> From: Martin Hancock <martin.hancock@ihug.co.nz>
>> Reply-To: phpug@phpug.org.nz
>> To: <phpug@phpug.org.nz>
>>
>>
>>
>> I have the following code in a include file that increases a value in an
>> array:
>>
>> if ($action=="Add"){
>> $ses_basket_amount[$basket_position]++;
>> }
>> elseif($action=="Remove"){
>> $ses_basket_amount[$basket_position]--;
>> }
>>
>> I want to be able to access this code using a form and I have the
>> following
>> form header:
>>
>> <form method="post" action="'.$PHP_SELF.'?action=Add"
>> name="shoppingCart">
>>
>> The form produces a table made up of products in a shopping cart and
>> beside
>> each line is 2 buttons (of input type) - a + and a -
>> (the + increases the quantity and the - decreases the quantity)
>>
>> Now, when either of the buttons is pressed then the form action is
>> carried
>> out (which in this case is $PHP_SELF?action=Add and the code requires
>> some
>> values from the form in order to successfully work) so the 'Add' code is
>> executed on the selected line and this works fine: the quantity is
>> increased. However, I want the 'Remove' code to be executed when the '-'
>> button is pressed but at the moment the 'Add' code is executed. I have
>> tried assigning a link to the '-' button but this does nothing -
>> information
>> that is fed into the script is displayed in hidden fields within my form
>> and
>> the only way this will work is if I feed the required information in
>> through
>> the URL and I dont want to do this.
>>
>> Is there a way I can make it so that the - button actually executes the
>> 'Remove' code and it can still obtain the required script information
>> from
>> the form? When the - button is set up as a link the information that is
>> needed to be fed into the remove code is not being obtained from the form
>> because it is not a form submit button.
>>
>> Hopefully that makes sense!
>>
>> Cheers
>>
>> ------------------------------------------------------------------
>> "Those of you who think you know everything are annoying to those of us
>> who
>> do." ~ David Brent
>>
>> Martin Hancock BInfoTech
>> Christchurch, New Zealand
>> Email -> martin.hancock@ihug.co.nz or martin.hancock@gmail.com
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: phpug-unsubscribe@phpug.org.nz
>> For additional commands, e-mail: phpug-help@phpug.org.nz
>>
>>
>>
>>
>>
>>
>>
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: idm-unsubscribe@hyperreal.org
For additional commands, e-mail: idm-help@hyperreal.org