Hi everyone,
I'm writing a web form and a backend Perl script to send a query to the administrator.
V1 of the script is working well, it's basically just a simple get-data-send-email [sendmail] script. V2, on the other hand, is a nightmare. I added just a few changes.
In the HTML page (which has become an SHTML page to support a server includes:
In the Javascript:
In the Perl:
I'm completely lost (as evidenced by my previous, late unlamented post...).
I should mention that I have tried changing the POST method to GET to try and see what is passed to the script, but nothing seems to be being passed over.
Also, I originally broke the code up into subroutines, but when the program didn't work I lumped it all back together again for troubleshooting purposes.
Perhaps I should break this problem into two and try to run the Perl script from the shell? How can I pass parameters to the script (i.e. "ip", "fullname" etc.)?
I'm writing a web form and a backend Perl script to send a query to the administrator.
V1 of the script is working well, it's basically just a simple get-data-send-email [sendmail] script. V2, on the other hand, is a nightmare. I added just a few changes.
In the HTML page (which has become an SHTML page to support a server includes:
Code:
<form method="post" onsubmit="return checkform()" action="/cgi-bin/activate_v2.pl" > <input type="hidden" id="ip" value="127.0.0.1" />
Code:
/* New code: Gets IP address using SSI */
var ip = '<!--#echo var="REMOTE_ADDR"-->';
/* New code: Adds IP address to hidden field */
document.getElementById("ip").value = ip;
Code:
my $ip = "127.0.0.1";
$ip = param('ip');
# now we can check the data
if ($fullname eq "" || $address eq "" || $username eq "" || $sender eq "") {
# we have incomplete data, so we will serve an error
# set the web page parameters
$content_header = 'Incomplete Information';
$content = '<p>Your activation request not been submitted.</p> <p>You did not fill out all of the requested information on the previous page. Please return to the main activation page and complete the form as directed.</p> <p>If you feel that you received this message in error, please <a href="mailto:admin@our-website.com">email the web services administrator</a>.</p>';
$site_url = '/activate/';
$link = 'Click here to return to the previous page';
# $activate = 0; # not needed as this parameter was set at the beginning
}
else {
# everything is okay
$activate = 1;
if ($activate == 1) {
# it's okay to submit the request
I should mention that I have tried changing the POST method to GET to try and see what is passed to the script, but nothing seems to be being passed over.
Also, I originally broke the code up into subroutines, but when the program didn't work I lumped it all back together again for troubleshooting purposes.
Perhaps I should break this problem into two and try to run the Perl script from the shell? How can I pass parameters to the script (i.e. "ip", "fullname" etc.)?
Comment