var dataObj = {
'do0' : '', // name
'do1' : '', //email
'do2' : '', //sunject
'do3' : '' // text
};
/* create the new xmlhttp req here */
function createXMLHttpRequest() {
var http = false;
if ( window.XMLHttpRequest ) {
try {
http = new XMLHttpRequest();
} catch (e) {
http = false;
}
}
else if ( window.ActiveXObject ) {
try {
http = new ActiveXObject("Msxml2.XMLHttp");
} catch (e) {
try {
http = new ActiveXObject("Microsoft.XMLHttp");
} catch (e ) { http = false; }
}
}
return http;
}
// simple testing assumes everything is ok :)
window.onload = function() {
document.getElementById("sender").onclick = function() {
for ( var i=0; i < 4; i++) {
dataObj['do'+i] = document.getElementById("do"+i).value;
//alert(dataObj['do'+i]);
}
var nr = new XMLHttpRequest();
var sent = "cgi-bin/ex2.pl?name="+dataObj['do0']+"&email="+dataObj['do1']+"&subject="+dataObj['do2']+"&text="+dataObj['do3'];
nr.open('post', sent, true);
nr.send();
}
}
####
#!/opt/lampp/bin/perl
use strict;
use warnings;
use CGI;
my $p = new CGI;
my ($name, $email, $sub, $txt) = (
$p->param('name'),
$p->param('email'),
$p->param('subject'),
$p->param('text'),
);
$p->header;
print "$name\n$email\n$sub\n$txt\n";
exit(0);
####
AllowOverride None
Options ExecCGI # this one
Order allow,deny
Allow from all