Results 1 to 6 of 6

Thread: Transfer Value

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Posts
    259

    Transfer Value

    I have 2 files (file.html) and (file.cgi)

    ---- file.html Contain this lines ----
    <form action="file.cgi">
    <INPUT TYPE="HIDDEN" NAME="NAME" VALUE="Khaled">
    <INPUT TYPE="HIDDEN" NAME="Age" VALUE="23">
    <input type="submit" value="SUBMIT"></form>
    <form>
    -------------------

    I want to print the name and age using CGI Code which will write in file (File.cgi)

    What is the code of file.cgi ?

    Thanks

  2. #2
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645
    try something like

    print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">";
    print "<html>";
    print "<body>";

    print "$FORM{'NAME'}";
    print "$FORM{'Age'}";

    print "</body>";
    print "</html>";

    You need to have activeperl installed for this though
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Posts
    259

    Sorry

    For Sorry . It does no work

  4. #4
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645
    Ooops, sorry, I forgot to paste the top part of my code

    #!/usr/bin/perl

    read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

    # Split the name-value pairs
    @pairs = split(/&/, $buffer);

    foreach $pair (@pairs) {
    ($name, $value) = split(/=/, $pair);

    # Un-Webify plus signs and %-encoding
    $value =~ tr/+/ /;
    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $value =~ s/<!--(.|\n)*-->//g;

    if ($allow_html != 1) {
    $value =~ s/<([^>]|\n)*>//g;
    }

    $FORM{$name} = $value;
    }
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

  5. #5
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Use POST instead of GET, so
    Code:
    <form method="POST" action="file.cgi">
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  6. #6
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 2001
    Location
    Manchester, UK
    Posts
    404
    try this, put the html file in your html root directory, and the cgi file in your cgi-bin directory!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width