Hi,
On my Apache web server, I ve created this little index.html 
script:
<HTML>
<HEAD><TITLE>My web page</TITLE></HEAD>
<BODY>
<P>
<FORM ACTION= /home/httpd/cgi-bin/query.pl METHOD=POST>
Enter Your name:
<INPUT TYPE= TEXT NAME= USERNAME SIZE= 25 MAXLEGTH= 50
VALUE= >
</P>
</FORM>
</BODY>
</HTML>
Now, with my browser, Lynx, I can see a Nice entry that asks me
to enter a Username, of course.
So, I went picking up a username on the fly and press enter.
Of course, My browser wont reply..probably because that username
I entered is strange to him. And here comes my question:
Say. I want to be able to enter a username called "spike"
for ie..and being able to get an output..or something to go around.
I guess I should create a cgi script file with the entry
"spike" mentionned somewhere..could anyone write a little quick cgi script
that can make that work..just to get the idea.
Cause what I mainly want  is to have my script responding with
with search results based on keyword "spike". As it;s a beginning, a little
script will help ..just to get the concept.
Well, I ve created following /home/httpd/cgi-bin/query.pl file, 
but it seems full of errors cause my html form seems not to cooperate with it:
#Contents of /home/httpd/cgi-bin/query.pl
if ($ENV {REQUEST_METHOD } ne POST ) {
        &send_error_page( Page was not accessed with POST operation. );
sub remove_escapes {
        local ($line) = @_;
        #You can try $line=$QUERY_STRING
        #First, change pluses (+) to spaces
        $line =~ s/\+/\ /g;
        #Then convert %XX values from hex to regular characters
        $line =~ s/%(..)pack( c,hex($1)) /ge;
        return( $line );
@name_value_pairs = split( /&/ , $ENV( QUERY_STRING );
foreach $pair ( @name_value_pairs ) {
        ($name,$value) = split( /=/,pair );
require cgi-lib.pl;
&ReadParse;
<P>
Your First Name : <INPUT TYPE= TEXT NAME= USERNAME>
<P>
Print Thank you, $in{ first_name }, for submitting your comments. ;
print <<EOF;
Content-type: text/html

Marc
-====---====---====---====---====---====---====---====---====---====---====-
 to unsubscribe email "unsubscribe linux-admin" to [EMAIL PROTECTED]
 See the linux-admin FAQ: http://www.kalug.lug.net/linux-admin-FAQ/

Reply via email to