Re: Looping Addition
| From: | Stephen | Date: | Thu, 05 Dec 2002 00:33:18 +0000 |
| Subject: | Re: Looping Addition | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-127070@lists.php.net to get a copy of this message | ||
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...
----- Original Message -----
From: "Ray Hunter" <ray@php.net>
To: "Stephen" <webmaster@melchior.us>
Cc: "PHP List" <php-general@lists.php.net>
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...
>
> 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:
> > Sorry for the uncontrolable emaling to the list but I'm in rather a
stump.
> > You may be hearing a lot from me over the next few days too.
> >
> > Anyway, I mentioned before my form with the addition that loops to the
> > number of numbers the user wants to add. Now to the part of the actual
> > addition, how could I loop that out also?
> >
> > Here's what I'm trying to do right now but naturally, it doesn't work:
> >
> > $output = 0;
> > $current = 1;
> > do
> > {
> > $output .= $num.$current +
> > $current++;
> > } while($current <= $_POST['vars']);
> >
> > Any help would be great! Thanks!
> >
> > Thanks,
> > Stephen Craton
> > http://www.melchior.us
> >
> > "What is a dreamer that cannot persevere?" --
> > http://www.melchior.us
> >
> >
> > ______________________________________________________________________
> >
> > --
> > 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
>
>