August 12th, 2003, 10:43 AM
-
variable scope
I'm new to WML. I'm confused with the scope of variables.
I thought that the variables are global to all cards in the same deck. But apparently it's not. Here's part of my code:
<p>Please enter a course code:</p>
<input name="course_code" size="9"/><br/>
<anchor>Submit<br/>
<go href="wml.cgi" method="post">
<postfield name="action" value="submit_course"/>
</go>
</anchor>
I didn't pass $(course_code) but in another deck, I tried to display $(course_code), and it was displayed correctly. How did it happened?
thanks.
oli
August 12th, 2003, 01:20 PM
-
You should use something like
<p>Please enter a course code:</p>
<input name="course_code" size="9"/><br/>
<anchor>Submit<br/>
<go href="wml.cgi" method="post">
<postfield name="action" value="submit_course"/>
<postfield name="course_code" value="$(course_code)"/>
</go>
</anchor>
August 12th, 2003, 01:25 PM
-
I know I should include the line
<postfield name="course_code" value="$(course_code)"/>
but somehow even I didn't include it, $(course_code) is still passed correctly to another deck.
That's why I'm confused.
Also, if I used 'course' instead of 'course_code' as the name of the field, should the name of variable be '$(course)' or '$(course_code)'?
If it's the latter one, what's the point of having the name?
Thank you.
oli