Midnite has asked for the wisdom of the Perl Monks concerning the following question:
I'm still a little lost. That tutorial from Ovid didn't really help, except to clean up my html. But I still have the problem of how to getting a send button and a file write to both to work at the same time.
Here is code for what I am doing:
I keep getting an error that it cannot open the file. But I put the param up farther near top of the program it works, but it still won't write the file. My theory is: When I do a button click, I noticed, and was told, it does an http post, so I assuming it wipes out the data# Setup up # Variables # and define work fields # If file exists, append to it 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: $!"; } # The param function to see if a button was clicked # If not, go on if (!(param())) { # Do stuff # By processing data # put up web page # with formatted data <form> <center><input type=submit value=Send name=S1> </center></form> } else { # When it is print # Redirect to another web page if (param('S1') eq "Send") { print BOBIN $datajoin; use CGI; print redirect("http://www.gailborden.info/services/b +ob/submitq.htm");} } close(BOBIN);
Is there easier way to just redirect it to a confirmation page AND write the data after pressing a button?
Does anyone know, if I change the "input type" to button can I do the same thing? When clicked, redirect to confirmation page and then write the data.
I will be more then happy to send the full script and web form.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Updated Button Question
by ikegami (Patriarch) on Aug 12, 2004 at 14:29 UTC | |
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 |