-
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
-
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
-
Sorry
For Sorry . It does no work
-
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;
}
-
Use POST instead of GET, so
Code:
<form method="POST" action="file.cgi">
-
1 Attachment(s)
try this, put the html file in your html root directory, and the cgi file in your cgi-bin directory!