Welcome to WebmasterWorld Guest from 54.144.206.73

Forum Moderators: open

browser location bar

altering what is shown in the location bar

   

naj

5:21 pm on Jan 21, 2002 (gmt 0)

10+ Year Member



Hi,
Anyone know how to alter the url shown in browser location bar so that it does not show cgi info?
I'd like it to show just the mycompany.com when executing a cgi script rather than showing the actual loction (mycompany.com/cgi-bin/whois/whois?STRING=gerlbultro.com&SearchType=do&STRING2.x=31&STRING2.y=6 and stuff like that). I don't want to use frames.
Thanks
5:23 pm on Jan 21, 2002 (gmt 0)

WebmasterWorld Administrator brett_tabke is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



I naj, welcome to the forums. Use a POST instead of a Get.
4:41 pm on Jan 22, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi naj,

in the form that calls the cgi script, there are a couple of methods of transferring the data. The most commonly used are GET and POST. With GET, the data contained in the form is encoded and made part of the URL that calls the cgi script. With, POST, the data is encoded differently and not included in the URL. You want to use the POST method. Here's an example:

<form name="yourform" action="cgiprocessingscript.cgi" method="POST">

The cgi script may need some modifications to decode the data... here is the routine I use in my scripts:

if ($ENV{'REQUEST_METHOD'} eq "POST") {
read(STDIN, $input, $ENV{"CONTENT_LENGTH"});
@holder = split(/&/, $input);
foreach $pair (@holder) {
($name, $value) = split(/=/, $pair, 2);

$value =~ s/\+/ /g;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/\r\n/\n/g;
$value =~ s/\r/\n/g;

$name =~ s/\+/ /g;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$name =~ s/\r\n/\n/g;
$name =~ s/\r/\n/g;

$fields{$name}=$value;
}
}

You end up with a hash (associative array) that contains the data.

For example, if you have form inputs including "name", "email", and "telephone", you would access these in your cgi script with the following variables:

$fields{'name'}
$fields{'email'}
$fields{'telephone'}

 

Featured Threads

Hot Threads This Week

Hot Threads This Month