Mobile Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsMobile ProgrammingMobile Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 12th, 2003, 10:43 AM
oli oli is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 56 oli User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 54 m 13 sec
Reputation Power: 10
Unhappy 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

Reply With Quote
  #2  
Old August 12th, 2003, 01:20 PM
omiossec omiossec is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Paris, France
Posts: 375 omiossec User rank is Lance Corporal (50 - 100 Reputation Level)omiossec User rank is Lance Corporal (50 - 100 Reputation Level)omiossec User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 16 h 4 m 46 sec
Reputation Power: 10
Send a message via ICQ to omiossec Send a message via AIM to omiossec
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>
__________________
Olivier Miossec
http://www.lasso-developpeur.net

Reply With Quote
  #3  
Old August 12th, 2003, 01:25 PM
oli oli is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 56 oli User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 54 m 13 sec
Reputation Power: 10
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsMobile ProgrammingMobile Programming > variable scope

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap