Gossamer Forum
Home : General : Perl Programming :

General CGI Question

Quote Reply
General CGI Question
Ok, I havn't been working with CGI very long, so if this is a stupid question forgive me. Say I wanted to make a script, and the address you could type was http://www.somewhere.com/cgi-test.cgi?john+smith and that address would take you to http://www.somewhere.com/johnsmith. How in the CGI script do I make it go to that when they type john+smith or a+person? For example, search engines do the same thing, when you search for something it takes you to www.yahoo.com/s/search.cgi?john+smith, and it gives the correct output. Thanks.
Quote Reply
Re: General CGI Question In reply to
I'm not to sure I know what your saying but try:
Code:
#!usr/bin/perl
$query_string = "$ENV{'QUERY_STRING'}";
$query_string =~ tr/+//;
print "Location: http://www.somewhere.com/$query_string\n\n";
This will take http://www.somewhere.com/cgi-test.cgi?john+smith and send it to http://www.somewhere.com/johnsmith.
Hope this helps.
Matt


[This message has been edited by matt (edited May 09, 1999).]