|
-
Mar 11th, 2002, 04:24 AM
#1
Thread Starter
Hyperactive Member
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
-
Mar 11th, 2002, 04:40 AM
#2
Fanatic Member
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
-
Mar 11th, 2002, 05:06 AM
#3
Thread Starter
Hyperactive Member
Sorry
For Sorry . It does no work
-
Mar 11th, 2002, 05:20 AM
#4
Fanatic Member
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;
}
-
Mar 11th, 2002, 12:12 PM
#5
Black Cat
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.
-
Mar 12th, 2002, 08:56 AM
#6
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|