ToWP: Storage of dynamically generated decks in the history stack

| | ToWP | Next |

If you use a CGI script and the post method to send data from the WAP browser to the CGI script the URL of this script always looks like:

This means that the browser stores only a single URL in its history stack irrespective of the number of calls of this script and the several dynamically generated WML decks. The user cannot browse back to one of these WML pages since there is only one entry in the history stack. The <prev/> task will present the last WML deck before the script has been accessed the first time.

One solution for this problem is to append a running number to the URL.

The URL of the first request:
The URL of the second request:
The URL of the third request:

And so on. Since the URL differ to each other they are stored in the history stack. uses the following code in the PERL script for Wireless SendMail:

The code to auto-increment the running number after the data sent to the server has been parsed:


The code to parse the data sent to the server:

sub parse_form_data
local ($query,$query_string,@key_value_pairs,$key_value,$key,$value);
if ($ENV{QUERY_STRING} ne ''){
$query_string = $ENV{QUERY_STRING};
if ($ENV{REQUEST_METHOD} =~ /^post$/i) {
read (STDIN, $query, $ENV{CONTENT_LENGTH});
$query_string .= '&' . $query;
elsif($ENV{REQUEST_METHOD} !~ /^get$/i) {
&return_error (500, 'Server Error','Browser uses unsupported method');
@key_value_pairs = split (/&/, $query_string);
foreach $key_value (@key_value_pairs) {
($key, $value) = split (/=/, $key_value);
$value =~ tr/+/ /;
$value =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack ("C", hex ($1))/eg;
if (defined($in{$key})) {
$in{$key} = join ("\0", $in{$key}, $value);
} else {
$in{$key} = $value;
foreach $key (keys %in){
$in{$key} = &decode($in{$key});
$in{$key} =~ s/^ //;
sub decode {
local ($s) = @_;
$s =~ tr/+/ /;
$s =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

The code in the dynamically generated deck:

<go href="$in{n}" sendreferer="true" method="post">

| | ToWP | Next |

© 2000 Contact