#!/usr/bin/perl # Mostafa Eldefrawy - # ------------------------------------------------------------ print "Content-type: text/html\n\n"; print "\n"; # Get the input #read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # Get the input for GET method $buffer = $ENV{'QUERY_STRING'}; # Split the name-value pairs @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; # Uncomment for debugging purposes #print "Setting $name to $value

"; $FORM{$name} = $value; } if($FORM{'cuisine'} eq 'Italian'){ print "Papa Mio Resturant: Good Spagetti - Bad Caneloni\n"; } elsif ($FORM{'cuisine'} eq 'Indian'){ print "Indian Restaurant: Good chiken/rice - Bad curry \n"; } elsif ($FORM{'cuisine'} eq 'American'){ print "American Restaurant: Good hot dog - Bad apple pie \n"; } print "\n";