How to use the global variable in web2py?


I tried to create a global variable called temp in web2py, but apparently the value of the variable doesn't change even if I try to store the user input to temp. It just stays the same (temp = 0.0). What's wrong?

Here is the
Here is the index.html:

Is there any other way to send user input to functions when creating images to HTML page? I have used the following line
to make the image but what is the correct syntax, if I want to send the user input to nonhomog_plot without using a global variable?

You can use globals in web2py, but they're not persistent. You could store temp in session if you like. (BTW, there's no need to declare a global in a context where you're only reading it.)

Alternatively, pass it in your URL's query string:

image = URL('nonhomog_plot', vars=dict(nu=str(value)))

or in your case, since you're receiving nu in vars already:

image = URL('nonhomog_plot', vars=request.vars)

or to include only nu:

image = URL('nonhomog_plot', vars=dict(