Re: newbie: goto url from var calc.
From: Grebo (me_at_me.com)
Date: Thu, 1 Apr 2004 19:09:57 +0100
Thanks Andrew Going to have a go with that.
"Andrew @ Rockface" <email@example.com> wrote in message
> 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:
> $sum = $_POST[num1] + $_POST[$num2];
> echo $sum;
> Andrew @ Rockface
> np: [winamp not running]
> "Andrew @ Rockface" <firstname.lastname@example.org> wrote in message
> > "Grebo" <email@example.com> wrote in message
> > news:firstname.lastname@example.org...
> > > 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
> > be
> > > used in next page.
> > > I've managed to get a page to echo the values in the next page using
> > > and submit.
> > > I even managed to make a link (Not Submit) that went to a page.php
> > on
> > > radio button value.
> > > But can't get the 2 to come together and not even looked at
> > say
> > > field1*field2.
> > Do the calculation in the page that you post the two values to, not the
> > page.
> > In other words:
> > page1 = form that accepts two fields as input and then posts the fields
> > 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: