I have read the following Thread:
http://www.gossamer-threads.com/...ew=&sb=&vc=1
And it seems close to what I want to do with the search.cgi but not exactly....
What I am attempting to do is allow people to select a "mode" to search (either my directory or the Web). If they choose "web" for the mode, then they will be redirected to another search engine result page.
Here is what I have done so far:
1) Edited sub main to look like the following:
sub main {
# ---------------------------------------------------
# Determine what to do.
#
my $in = new CGI;
my $dynamic = $in->param('d') ? $in : undef;
print $in->header();
if ($in->param('query')) {
&search ($in, $dynamic);
}
elsif ($in->param('mode') eq 'attech') {
&attech ($in, $dynamic);
}
elsif ($in->param('mode') eq 'wwwvl') {
&wwwvl ($in, $dynamic);
}
elsif ($in->param('mode') eq 'web') {
&websearch ($in, $dynamic);
}
elsif ($in->param('mode') eq 'books') {
&books ($in, $dynamic);
}
else {
my $title_linked = &build_linked_cgi_title ("Search Site");
&site_html_search_form ( { query => '', title_linked => $title_linked}, $dynamic );
}
}
2) Then I added the subs for the other search engine. Here is an example:
sub books {
#---------------------------------------------------------
# Searches Amazon.com
my ($in, $dynamic) = @_;
my $engine = "http://vlib.anthrotech.com/bin/amazon.cgi?keyword=";
my $redir = $in->param('query');
# Convert spaces to plus's
$redir =~ s/\ /+/g;
print $in->redirect ("$engine$redir&whichamazon=http://www.amazon.com&mymode=first&tag=anthrotechbookst");
}
This does not work...what happens is that a new result page appears adding mode=books to the query string. It does not redirect to the other search engines.
Any thoughts?
Thanks in advance (TIA).
Regards,
Eliot
http://www.gossamer-threads.com/...ew=&sb=&vc=1
And it seems close to what I want to do with the search.cgi but not exactly....
What I am attempting to do is allow people to select a "mode" to search (either my directory or the Web). If they choose "web" for the mode, then they will be redirected to another search engine result page.
Here is what I have done so far:
1) Edited sub main to look like the following:
Code:
sub main {
# ---------------------------------------------------
# Determine what to do.
#
my $in = new CGI;
my $dynamic = $in->param('d') ? $in : undef;
print $in->header();
if ($in->param('query')) {
&search ($in, $dynamic);
}
elsif ($in->param('mode') eq 'attech') {
&attech ($in, $dynamic);
}
elsif ($in->param('mode') eq 'wwwvl') {
&wwwvl ($in, $dynamic);
}
elsif ($in->param('mode') eq 'web') {
&websearch ($in, $dynamic);
}
elsif ($in->param('mode') eq 'books') {
&books ($in, $dynamic);
}
else {
my $title_linked = &build_linked_cgi_title ("Search Site");
&site_html_search_form ( { query => '', title_linked => $title_linked}, $dynamic );
}
}
2) Then I added the subs for the other search engine. Here is an example:
Code:
sub books {
#---------------------------------------------------------
# Searches Amazon.com
my ($in, $dynamic) = @_;
my $engine = "http://vlib.anthrotech.com/bin/amazon.cgi?keyword=";
my $redir = $in->param('query');
# Convert spaces to plus's
$redir =~ s/\ /+/g;
print $in->redirect ("$engine$redir&whichamazon=http://www.amazon.com&mymode=first&tag=anthrotechbookst");
}
This does not work...what happens is that a new result page appears adding mode=books to the query string. It does not redirect to the other search engines.
Any thoughts?
Thanks in advance (TIA).
Regards,
Eliot