This question is from another question I asked, but it may be to buried for people to see, so I am resending it as a new 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:

# 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);
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

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.

Joseph A. Ruffino
Automated Systems Assistant
Gail Borden Public Library District
270 N. Grove Ave
Elgin, Il, 60120
847-742-2411 x5986

In reply to Updated Button Question by Midnite

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.