RE: [PHP] Looping Addition

2002-12-06 Thread Ford, Mike [LSS]
- Original Message - From: "Chris Wesley" <[EMAIL PROTECTED]> To: "PHP List" <[EMAIL PROTECTED]> > On Wed, 4 Dec 2002, Stephen wrote: > > This is only a snippet, there is more to it but for simplicities sake... > > Then I calculate it. My question is, how would I loop the adding? I hope yo

Re: [PHP] Looping Addition

2002-12-05 Thread Stephen
PROTECTED]> Sent: Thursday, December 05, 2002 3:14 PM Subject: Re: [PHP] Looping Addition > > But then, if the user entered 5 - 6, it should be -1 but it'd return > > positive one... Is there another way? > > Come on, man... this is addition and subtraction. You c

Re: [PHP] Looping Addition

2002-12-05 Thread 1LT John W. Holmes
> But then, if the user entered 5 - 6, it should be -1 but it'd return > positive one... Is there another way? Come on, man... this is addition and subtraction. You can't figure it out? > > You simply need the absolute value of the difference. So taking Stephen's > > example below.. > > > > $tot

Re: [PHP] Looping Addition

2002-12-05 Thread Stephen
gt; Cc: "PHP List" <[EMAIL PROTECTED]> Sent: Thursday, December 05, 2002 2:51 PM Subject: Re: [PHP] Looping Addition > You simply need the absolute value of the difference. So taking Stephen's > example below.. > > $total = 0; > foreach( $_POST['nums

Re: [PHP] Looping Addition

2002-12-05 Thread Kevin Stone
riginal Message - From: "Stephen" <[EMAIL PROTECTED]> To: "Chris Wesley" <[EMAIL PROTECTED]> Cc: "PHP List" <[EMAIL PROTECTED]> Sent: Thursday, December 05, 2002 12:33 PM Subject: Re: [PHP] Looping Addition > Continuing this even more...how would I

Re: [PHP] Looping Addition

2002-12-05 Thread Stephen
AIL PROTECTED]> Sent: Wednesday, December 04, 2002 8:42 PM Subject: Re: [PHP] Looping Addition > On Wed, 4 Dec 2002, Stephen wrote: > > This is only a snippet, there is more to it but for simplicities sake... > > Then I calculate it. My question is, how would I loop the adding? I

Re: [PHP] Looping Addition

2002-12-05 Thread Jason Wong
On Thursday 05 December 2002 23:05, Stephen wrote: > So would I just put this? > > foreach(%_POST['number'] as $num) > { > $output *= $num; > } > echo $output; > > That's for multiplication. Yes. Wouldn't it have been quicker for you to try it than to ask? BTW make sure that none of $num is z

Re: [PHP] Looping Addition

2002-12-05 Thread Stephen
: "PHP List" <[EMAIL PROTECTED]> Sent: Thursday, December 05, 2002 8:24 AM Subject: Re: [PHP] Looping Addition > > One more question... If I then wanted to do this for the other operations > > (such as multiplication, division, etc), how would I do that? > > Assuming yo

Re: [PHP] Looping Addition

2002-12-05 Thread 1LT John W. Holmes
> One more question... If I then wanted to do this for the other operations > (such as multiplication, division, etc), how would I do that? Assuming you've figured out how to do an array... You'll have to loop through the values like in the code that others posted. foreach($_POST['number'] as $n

Re: [PHP] Looping Addition

2002-12-05 Thread Stephen
27;Chris Wesley'" <[EMAIL PROTECTED]> Cc: "'PHP List'" <[EMAIL PROTECTED]> Sent: Wednesday, December 04, 2002 9:01 PM Subject: RE: [PHP] Looping Addition > > Let me explain this as best I can. The user enters how many numbers he > > wants >

RE: [PHP] Looping Addition

2002-12-04 Thread John W. Holmes
> Let me explain this as best I can. The user enters how many numbers he > wants > to add. This form goes to another page. This page loops a form field and > it's name is "num" and after num is the number it is currently on. Here's > the code: > > > > How many numbers to add: >

Re: [PHP] Looping Addition

2002-12-04 Thread Stephen
st" <[EMAIL PROTECTED]> Cc: "Stephen" <[EMAIL PROTECTED]> Sent: Wednesday, December 04, 2002 8:42 PM Subject: Re: [PHP] Looping Addition > On Wed, 4 Dec 2002, Stephen wrote: > > This is only a snippet, there is more to it but for simplicities sake... > >

Re: [PHP] Looping Addition

2002-12-04 Thread Chris Wesley
On Wed, 4 Dec 2002, Stephen wrote: > This is only a snippet, there is more to it but for simplicities sake... > Then I calculate it. My question is, how would I loop the adding? I hope you > understand this now... Ah!, I think I understand better now. You want to add num1, num2, num3, ... numN, w

Re: [PHP] Looping Addition

2002-12-04 Thread Tom Rogers
Hi, Thursday, December 5, 2002, 7:26:57 AM, you wrote: S> Sorry for the uncontrolable emaling to the list but I'm in rather a stump. S> You may be hearing a lot from me over the next few days too. S> Anyway, I mentioned before my form with the addition that loops to the S> number of numbers the u

Re: [PHP] Looping Addition

2002-12-04 Thread Stephen
e... Then I calculate it. My question is, how would I loop the adding? I hope you understand this now... - Original Message - From: "Chris Wesley" <[EMAIL PROTECTED]> To: "PHP List" <[EMAIL PROTECTED]> Cc: "Stephen" <[EMAIL PROTECTED]> Se

Re: [PHP] Looping Addition

2002-12-04 Thread Chris Wesley
On Wed, 4 Dec 2002, Stephen wrote: > I already have that. $_POST['vars'] is a number and I already check that you > on a page before. All I need to know is how to keep adding numbers until > there are no more to add... If you mean that $_POST['vars'] is an array of numbers: $total = 0; foreach(

Re: [PHP] Looping Addition

2002-12-04 Thread Stephen
t; <[EMAIL PROTECTED]> Cc: "PHP List" <[EMAIL PROTECTED]> Sent: Wednesday, December 04, 2002 4:33 PM Subject: Re: [PHP] Looping Addition > What type is $_POST['vars']? I think that it is a string...you might > have to convert it to an integer... > >

Re: [PHP] Looping Addition

2002-12-04 Thread Ray Hunter
What type is $_POST['vars']? I think that it is a string...you might have to convert it to an integer... if( is_numeric( $_POST['vars'] ) ) { $vars = (int)$_POST['vars']; } else { echo "Error: \$_POST['vars'] is not an integer."; } On Wed, 2002-12-04 at 14:26, Stephen wrote: > So