Re: newbie: goto url from var calc.

From: Grebo (me_at_me.com)
Date: 04/01/04


Date: Thu, 1 Apr 2004 19:09:57 +0100

Thanks Andrew Going to have a go with that.

"Andrew @ Rockface" <andrew@rockface-records.co.uk> wrote in message
news:c4gip1$o9j$1@sparta.btinternet.com...
> Oops, had a bit of a finger fart. Here's where I left of:
>
> If you want to use POST as your method in page1.html, change page2.php to
> the following:
> <?php
> $sum = $_POST[num1] + $_POST[$num2];
> echo $sum;
> ?>
>
> --
> Andrew @ Rockface
> np: [winamp not running]
> andrew@rockface-records.co.uk
> www.rockface-records.co.uk
>
>
> "Andrew @ Rockface" <andrew@rockface-records.co.uk> wrote in message
> news:c4gijq$o2e$1@sparta.btinternet.com...
> > "Grebo" <me@me.com> wrote in message
> > news:c4fvcr$4nm$1@titan.btinternet.com...
> > > New to PHP and just done the "Hello Wolrd" now on a quest.
> > > I want to have say 2 fields in a form that calculate a value and then
> > based
> > > on that value
> > > goto a URL containing that value and also have the value carried over
to
> > be
> > > used in next page.
> > > I've managed to get a page to echo the values in the next page using
> post
> > > and submit.
> > > I even managed to make a link (Not Submit) that went to a page.php
based
> > on
> > > radio button value.
> > > But can't get the 2 to come together and not even looked at
calculating
> > say
> > > field1*field2.
> >
> > Do the calculation in the page that you post the two values to, not the
> form
> > page.
> > In other words:
> > page1 = form that accepts two fields as input and then posts the fields
to
> > page2.
> > page2 = calculate the sum of the two passed fields/variables and display
> > sum.
> >
> > page1.html
> > <form action="page2.php" method="GET">
> > <input type="text" name="num1">
> > <input type="text" name="num2">
> > <input type="submit" value="Submit">
> > </form>
> >
> > page2.php
> > <?php
> > $sum = $num1 + $num2;
> > echo $sum;
> > ?>
> >
> > if you want to use POST as your method change page2.php to:
> >
> >
>
>