On Fri, 5 Apr 2002 10:07:45 -0500 , [EMAIL PROTECTED] (Andrew
Hughes) wrote:

>I have a tab delimited flat text-file database (hotels.txt) with hotel info
>from all 50 states in the following fields:
>
>$available (1=available; 0=unavailable)
>$location_num (numbers 1-50)
>$location_txt
>$city
>$hotel_name
>$celo_inc_pub_rates
>$ia_inc_pub_rates
>$celo_room_only_rates
>$ttg_room_only_rates
>$url
>
>I must query it using the GET method because I want to hardcode the queries
>for people to select hotel locations in an image map using the multiple
>criteria (name1=value1&name2=value2) in the query_string (please note: it's
>a long story, but I cannot use cgi.pm on my server(s) at work.).  For
>example, if someone clicks on Georgia, the resulting page will output
>information (from all of the text-file database fields) for the available
>locations in the state of Georgia using the following hard-coded a href
>link:
>
><a
>href="http://www.mysite.com/cgi-bin/find_hotels.cgi?available=1&location_num
>=5">
>
>I can handle the .html output of a text-file query using a form and the post
>method, but I just cannot get the url query string and the GET method to
>select the appropriate records.  How do I accomplish this?
>
>Thanks in advance for your help.
>
>Andrew

I'm guessing at what you want or need to do, the explanation isn't totally
clear to me. This is a brief outline of what I would do.
This has all sorts of hidden complexities to it, which I'm not touching upon,
like whether old browsers can use it etc.

What you need to do is have a form where the user selects a state, like

http://www.mysite.com/cgi-bin/find_hotels.cgi?state=georgia

then in your find_hotels.cgi  you need something to get the
query string and split it. CGI.pm  is the easiest, but you will need to devise
your own or use the old ReadParse routine.

Anyways, when you are done parsing the input string,
you should have:
state = georgia

I left alot of steps out here, because I'm not writing the thing for you. :-) 
Anyways, you should end up with

$statefile = georgia;

Then take your database of states, say 1 state per file, and 1 hotel per line
and get them into an array which you can use to generate your links.
$statefile='georgia':
open(SH,"<$statefile") or die "Can't find open $statefile: $!";
@hotels = <SH>;
@hotels = sort @hotels;
$count = 1;

print "Content-Type: text/html\n\n";
foreach $hotel (@hotels) {
($hotel, $available,$loc_number..........)= split (/,/,$hotel)
#this splits your hotel entries into their values, the .........are for brevity.

print"<a href=http://www.mysite.com/find_hotel.cgi?name=$hotel&;
            available=$available&location_num=$loc_number&
            ......... 
            ........   # this is actually all 1 long string, but my wordwrap 
            ........  # won't allow it                   
            >$hotel</a>                  
print "<br>";
$count = $count+1; 
}if ($count == 0 ){print "No Hotels<br>"}
}

#If you have any spaces in your string, replace them with %20. It's called
#url encoding, and you will have to do it for spaces, and certain other
#characters.  For this step, you don't need all the hotel info, just it's name
#,price , and rooms available.          You could do all kinds of custom sorting
#before sending these links out. Sort by price, room size, jacuzzi, etc.


That should print out your georgia links to the user. Then when they select
a link, your find_hotel.cgi has to take the new query string and display the
selected hotels information in a table or something. You would do the exact step
above, except instead of printing the hotel data to a link, you would output
it to a table for the customer to view. In this printout, you would include all
the hotel information.
You probably would eventually enhance it
to include a form for the customer to signup for a room, and forward it to the
hotel.

Good luck, this is actually a pretty big project by the time you get all the
details worked out.

























-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to