Re: use a value form a manu list in a form on the same page [message #181610 is a reply to message #181228] |
Fri, 24 May 2013 00:19 |
Denis McMahon
Messages: 634 Registered: September 2010
Karma:
|
Senior Member |
|
|
On Mon, 22 Apr 2013 03:40:12 -0700, newbie php wrote:
> I'm so glad you guys helped me out a couple of days ago, so i thought
> i'd had another go.
You did? How did that work out for you.
> Here's the situation: in a form i want a visitor to choose form a list a
> value of 1 to 10.
Yeah, in a form if you want the user to choose a number like that you can
use an html select / option, or a set of radio buttons, or you could use
a text input and let the user enter a number, but they might enter a
number outside your range.
> This chosen value should be multiplied by a value of
> 2750 which should be stored in a variable and shown on the page
> (recalculated by any change in the list)
This sounds more like a javascript thing than a php thing, you probably
don't want to submit your form to the server each time the user changes
their option.
> this value does nog necesarily be in the form itself. The most important
> question is how to put the chosen value in a variable.
Not quite sure what a nog is.
Well you'd use an appropriate javascript function to get the value from
the input type that you were using, making sure that you did any needed
conversions to numeric data if it started life as a string value, and
then do the relevant multiplication and display it in a suitable output
location.
> Any help is greatly appreciated
You're welcome.
xp and fu set, this sounds like primarily a js issue, not a php one
--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
|
|
|