CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Sending Variables from my script to a HTML Page

 



varo
stranger

Jun 12, 2001, 10:32 PM

Post #1 of 2 (854 views)
Sending Variables from my script to a HTML Page Can't Post

How do I send the variables that I get with my script to a HTML page with out using the get method?

I have a script that I use to get some vital information from users that visit my website. The scripts consists
of a form with the get method, where the users fills the requested information. The scripts validates the information before submiting it to our database.

Once verified, all the information is then stored in a local data base in my server.

What I whant to do, is after collecting the information, is to send it to a webpage in another server.

How can send this variables to a HTML page with out using the get method.

Right now I use the get method to resend the variables to a second webpage in another server , but the variables are visible in the url. What I whant to do is to avoid this:

$url = "../reports.html?cas=$name_cas&userid=$user&pass=$pass&phone=$phone&email=$email&response_code=AR&num_autoriza=$response_aut&operation=$com_internal&date=$fecha:$hora&amount=$entero.$decimal";

The purpose of this is to send the information that I collect to another server where ths information is also going to be stored in a database.

There can be more than one user at the same time posting their information.

regards,
alvaro




streetstopper
Deleted

Jun 17, 2001, 9:14 AM

Post #2 of 2 (833 views)
Re: Sending Variables from my script to a HTML Page [In reply to] Can't Post

you can use the "post" method instead...but you must include the variables and their values as hidden fields.

sending data to a server using the "post" method is basically the same as the get...just check any html reference.

however parsing of data by the cgi script may be different.

here is the script i use for parsing to both get and post methods. the sent variables are then used as $formdata{'variable'}

#beginning of code
$method=$ENV{'REQUEST_METHOD'};
if($method eq "GET") {
$rawdata=$ENV{'QUERY_STRING'};
} else {
read(STDIN,$rawdata,$ENV{'CONTENT_LENGTH'});
}
@value_pairs=split(/&/,$rawdata);
%formdata=();
foreach $fieldvalue(@value_pairs) {
($field,$value)=split(/=/,$fieldvalue);
$value=~s/ /\0/eg;
$value=~tr/+/ /;
$value=~s/
/"\n"/eg;
$value=~s/%([\dA-Fa-f][\dA-Fa-f])/pack("c",hex($1))/eg;
$formdata{$field}=$value;
}
#ending of code

if you need some more explanation, please do email me at dennisblazo@hotmail.com


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives