Here's how to handle the above problem with a server-side CGI script to the drop-down list, instead of solving client-side JavaScript. They wonder why someone would take care of even with a JavaScript solution, when a CGI solution to accommodate others? Now, install unfortunately most internet provider is not new CGI scripts into free space, they offer. The other reason is, even if you have CGI access, installing CGI scripts requires experience and patience, if you've never been a CGI script before installing.
First, look for the CGI script itself. We use the Perl language to the CGI script to write because it is the most common server scripting language for web servers. Do not forget to adapt the following script file extension "*. txt" from the "*. pl" or "*. cgi" on your web server needs. Since there is no standard instructions that operate on any web server when you install CGI scripts in Perl, we are not here at this time. Your internet provider must be able to let you know if you have CGI access and to specific instructions on your web server.
#!/usr/bin/perl
sub xcgi_InitForm
{
my($h) = '[a-fA-F0-9]';
my($buff, @params, $param);
my($param_name, $param_value);
local(*xcgi_form) = @_ if @_;
read(STDIN, $buff, $ENV{'CONTENT_LENGTH'});
@params = split(/&/, $buff);
foreach $param (@params)
{
($param_name, $param_value) = split(/=/, $param);
$param_value =~ tr/+/ /;
$param_value =~ s/%($h$h)/pack("C",hex($1))/eg;
$xcgi_form{$param_name} = $param_value;
}
}
{
my(@form);
xcgi_InitForm(*form);
$url = $form{'url'};
print "Location: $urlnn";
}
sub xcgi_InitForm
{
my($h) = '[a-fA-F0-9]';
my($buff, @params, $param);
my($param_name, $param_value);
local(*xcgi_form) = @_ if @_;
read(STDIN, $buff, $ENV{'CONTENT_LENGTH'});
@params = split(/&/, $buff);
foreach $param (@params)
{
($param_name, $param_value) = split(/=/, $param);
$param_value =~ tr/+/ /;
$param_value =~ s/%($h$h)/pack("C",hex($1))/eg;
$xcgi_form{$param_name} = $param_value;
}
}
{
my(@form);
xcgi_InitForm(*form);
$url = $form{'url'};
print "Location: $urlnn";
}
Listing #1 : PERL code. Download redir.pl (0.44 KB).
<form method="POST" action="/cgi-bin/redir.pl">
<SELECT NAME="url">
<OPTION VALUE="http://www.chami.com/tips/">
Select a page to visit and click GO</OPTION>
<OPTION VALUE="http://www.chami.com/tips/html/">
HTML Tips</OPTION>
<OPTION VALUE="http://www.chami.com/tips/windows/">
Windows Tips</OPTION>
</SELECT>
<input type="SUBMIT" value="GO">
</form>
<SELECT NAME="url">
<OPTION VALUE="http://www.chami.com/tips/">
Select a page to visit and click GO</OPTION>
<OPTION VALUE="http://www.chami.com/tips/html/">
HTML Tips</OPTION>
<OPTION VALUE="http://www.chami.com/tips/windows/">
Windows Tips</OPTION>
</SELECT>
<input type="SUBMIT" value="GO">
</form>
Listing #2 : HTML code. Download dropdown.html (0.35 KB).
<OPTION VALUE="http://www.chami.com/">
Chami.com home page</OPTION>
Chami.com home page</OPTION>
Listing #3 : HTML code. Download option.html (0.2 KB).
0 comments:
Post a Comment