RE: [PHP] Need to maintain the integrity of the checkbox

2004-07-29 Thread Jay Blanchard
[snip]
I have created a form that lists the possible sponsorships of various
events.  I need to keep the names of the checkbox to identify the
specific
event, but the value is a dollar amount that needs to pass thru to the
checkout area function.  Without creating an array that would loose the
events names (some events have the same dollar amount), how can I
capture
the dollar value(s) checked an pass them to the checkout form?
[/snip]

I don't think you explained this well, but I'll take a shot

input type=checkbox name=EventFoo value=

When this is passed to processing via a POST event it becomes

$_POST['EventFoo'] (that contains the value entered in the form, like 5
bucks)

So for each event name you will have a like POST array item containing
the value.

Does this help?

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



RE: [PHP] Need to maintain the integrity of the checkbox

2004-07-29 Thread Jay Blanchard
[snip]
Your right, I didn't explain fully.  If I have two events where the
value=$5, then after I have looped thru the array I know they want to
pay
the $5, but not which event that goes to because multiple events are
that
value.  What I'm thinking I'll do is make one array and give each event
a #,
then after checking for the selected checkbox, validate which number and
pass thru the event and corresponding dollar amount.  Sound like the
best
solution?  If not, I hope I have explained a little more precise.
[/snip]

A. Always reply back to the list in case the responder is no longer
available which may leave you hanging.

2. Even though multiple events have the same value ($5) they are listed
in the POST array according to the name the event input was given in the
form. You do not need to do the above unless you have a badly done form.
Why don't you send the code from the portion of the form we are talking
about and we can help better.

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



Re: [PHP] Need to maintain the integrity of the checkbox

2004-07-29 Thread Jason Wong
On Thursday 29 July 2004 22:04, Andrew Reilly wrote:

 I have created a form that lists the possible sponsorships of various
 events.  I need to keep the names of the checkbox to identify the specific
 event, but the value is a dollar amount that needs to pass thru to the
 checkout area function.  Without creating an array that would loose the
 events names (some events have the same dollar amount), how can I capture
 the dollar value(s) checked an pass them to the checkout form?

Not exactly sure what you're trying to do. However you seem to be wanting to 
pass around monetary values via forms. In general this is a VERY BAD idea. 
Data submmitted from forms should not be trusted. Instead you should only 
link the events to their monetary values (using a back-end lookup table or 
whatever) AFTER the form is submitted.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
An infallible method of conciliating a tiger is to allow oneself to be
devoured.
-- Konrad Adenauer
*/

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



RE: [PHP] Need to maintain the integrity of the checkbox

2004-07-29 Thread Andrew Reilly
Example of form:
td height=52 align=left valign=middleinput type=checkbox
name=wbc_Money value=$5000
  Power of Money Series ($5000) img src=images/sold_Out.gif
border=0Power 
  of Politics ($3500)br input type=checkbox name=wbc_Wine
value=$1000
  Power of Wine nbsp;nbsp; input type=checkbox name=wbc_Golffall
value=$3500
  Power of Golf (Fall) Series ($3500)br input type=checkbox
name=wbc_Golfspring value=$3500
  Power of Golf (Spring) Series ($3500)/td

So the dollar amounts are the same for three of the four events, but this is
just a snippet of about 20 items.  If I take out the dollar amounts, and
just populate an array with what are now the descriptive names, I can assign
dollar amounts in the checkout script.  Am I on the right track?


-Original Message-

Subject: RE: [PHP] Need to maintain the integrity of the checkbox

[snip]
Your right, I didn't explain fully.  If I have two events where the
value=$5, then after I have looped thru the array I know they want to
pay
the $5, but not which event that goes to because multiple events are
that
value.  What I'm thinking I'll do is make one array and give each event
a #,
then after checking for the selected checkbox, validate which number and
pass thru the event and corresponding dollar amount.  Sound like the
best
solution?  If not, I hope I have explained a little more precise.
[/snip]

A. Always reply back to the list in case the responder is no longer
available which may leave you hanging.

2. Even though multiple events have the same value ($5) they are listed
in the POST array according to the name the event input was given in the
form. You do not need to do the above unless you have a badly done form.
Why don't you send the code from the portion of the form we are talking
about and we can help better.

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



RE: [PHP] Need to maintain the integrity of the checkbox

2004-07-29 Thread Jay Blanchard
[snip]
Example of form:
input type=checkbox name=wbc_Money value=$5000
input type=checkbox name=wbc_Wine value=$1000
input type=checkbox name=wbc_Golffall value=$3500
input type=checkbox name=wbc_Golfspring value=$3500

So the dollar amounts are the same for three of the four events, but
this is
just a snippet of about 20 items.  If I take out the dollar amounts, and
just populate an array with what are now the descriptive names, I can
assign
dollar amounts in the checkout script.  Am I on the right track?
[/snip]

Yes you are...each would be available thusly.(with your names and
current values once the submit button is pressed)

$_POST['wbc_Money']; would be equal to $5000
$_POST['wbc_Wine']; would be equal to $1000
$_POST['wbc_Golffall']; would be equal to $3500
$_POST['wbc_Golfspring']; would be equal to $3500

The $_POST array will be populated for you, you do not need to populate
a seperate array. Try it!

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



RE: [PHP] Need to maintain the integrity of the checkbox

2004-07-29 Thread Andrew Reilly

So the ?=$_POST['wbc_Event']? would go in the value or name field of the
checkbox?

-Original Message-
From: Jay Blanchard [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 29, 2004 10:01 AM
To: Andrew Reilly; [EMAIL PROTECTED]
Subject: RE: [PHP] Need to maintain the integrity of the checkbox

[snip]
Example of form:
input type=checkbox name=wbc_Money value=$5000
input type=checkbox name=wbc_Wine value=$1000
input type=checkbox name=wbc_Golffall value=$3500
input type=checkbox name=wbc_Golfspring value=$3500

So the dollar amounts are the same for three of the four events, but
this is
just a snippet of about 20 items.  If I take out the dollar amounts, and
just populate an array with what are now the descriptive names, I can
assign
dollar amounts in the checkout script.  Am I on the right track?
[/snip]

Yes you are...each would be available thusly.(with your names and
current values once the submit button is pressed)

$_POST['wbc_Money']; would be equal to $5000
$_POST['wbc_Wine']; would be equal to $1000
$_POST['wbc_Golffall']; would be equal to $3500
$_POST['wbc_Golfspring']; would be equal to $3500

The $_POST array will be populated for you, you do not need to populate
a seperate array. Try it!

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

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



RE: [PHP] Need to maintain the integrity of the checkbox

2004-07-29 Thread Jay Blanchard
[snip]
So the ?=$_POST['wbc_Event']? would go in the value or name field of
the
checkbox?
[/snip]

No, just value=

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



RE: [PHP] Need to maintain the integrity of the checkbox

2004-07-29 Thread Jay Blanchard
[snip]
[snip]
So the ?=$_POST['wbc_Event']? would go in the value or name field of
the
checkbox?
[/snip]

No, just value=
[/snip]

I should have been more descriptive. When you click the SUBMIT button
the values entered will appear in the $_POST array

A small example

page1.php (the form page)

?php
/* no php code needed */
?
html
headtitlePOST Test/title/head
body
form action=page2.php method=POST
input type=text name=thisVar value=br
input type=text name=thatVar value=br
input type=submit name=action value=SUBMIT FORMbr
/form
/body
/html

page2.php (the processing page)

?php
/* here are the post array variables we have spoken about */
echo $_POST['thisVar'] . br;
echo $_POST['thatVar'] . br;
?

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