|8.9 Why aren't the server receiving the variables I send it?|
Variables from user input or other can be sent to the server the same way as it would be done in the HTML world. That is, from a <FORM>either by a POST or a GET.
It is important to have at least some understanding of the difference between a POST and a GET. For POSTs, the browser generates a block of data containing the variable names and their content which it sends to the server. For GETs, which are really just a normal request for a URL, the variable names and contents are located in the URL itself.
For POST specific problems, also check this.
As the WAP environment is very strict, it is important to follow the standards. Although the following URL will work in most HTML environments
the same URL in the WAP environment will not work. The line above is partially encoded to protect the variable contents from being incorrectly translated. Specifically the whitespace between banana and bender. URLs can after all not contain any whitespaces.
The reason why the line above won't work in WAP is that the & ampersand that separate each variable and variable content pair is not escaped/encoded. The correct format of the above line should be
where the & is replaced by its Character Entity.
Just to illustrate even further, here's some WML code.
<card id="input" title="Gimme some data"> <p><input type="text" name="username" format="M*m"/></p> <p><input type="text" name="occupation" format="M*m"/></p> <p><anchor>Send this<go href="/cgi-bin/somescript?username=$(username)&occupation=$(occupation)"/></anchor></p>
Note that this isn't really WAP specific. Special characters should always be encoded/escaped or you might get unpredictable results.
|[ Main ] [ 08 - Troubleshooting ]|
© Copyright The Wireless FAQ. All Rights Reserved. Terms | Site Map