in reply to Updated Button Question
If I understand correctly, you want to send the parameters both to your script (so you can print them) and to a second script (submitq). That's quite tricky because HTTP & HTML designers failed to forsee the need to do a POST redirection. If you only needed to send it to submitq, then you could:
<form ...> <center><input type=submit value=Send name=S1></center> </form>
to:
<form method="POST" action="http://.../submitq.cgi"> <center><input type=submit value=Send name=S1></center> </form>
One way would be to get JavaScript to do a post by changing:
# When it is print # Redirect to another web page if (param('S1') eq "Send") { print BOBIN $datajoin; print redirect("http://.../submitq.cgi"); }
to:
if (param('S1') eq "Send") { print BOBIN $datajoin; <body onload="form1.submit()"> <form name="form1" method="POST" action="http://.../submitq.cg +i"> foreach ($cgi->params()) { <input type=hidden name="$_" value="$cgi->param($_);" > } </form> }
Another alternative is a "subquery". Change:
# When it is print # Redirect to another web page if (param('S1') eq "Send") { print BOBIN $datajoin; print redirect("http://.../submitq.cgi"); }
to:
if (param('S1') eq "Send") { print BOBIN $datajoin; require LWP::UserAgent; require HTTP::Request::Common; $ua = ...; $ua->request(POST 'http://.../submitq.cgi', [ params ]); print the response. }
As an aside, open(FH, ">>...") will create the file if necessary, so
if (-e $datefile) { open (BOBIN, ">>$datefile") || die "Cannot Open File $datefile for + writing: $!"; # Open Data file } else { ### Else open directory where files data files are located # Sort in descending order, pick out first file # And e-mail it # Then create a new file with current data as name open (BOBIN, ">$datefile") || die "Cannot create File $datefile f +or writing: $!"; }
simplifies to
open (BOBIN, ">>$datefile") || die "Cannot Open File $datefile for + writing: $!"; # Open/Create Data file
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Updated Button Question
by Midnite (Acolyte) on Aug 12, 2004 at 15:16 UTC | |
by ikegami (Patriarch) on Aug 12, 2004 at 15:50 UTC | |
by Midnite (Acolyte) on Aug 12, 2004 at 16:23 UTC | |
by ikegami (Patriarch) on Aug 12, 2004 at 16:44 UTC |