Re: CGI Question

From: John Halladay (john_at_greenaspen.com)
Date: 11/08/03

  • Next message: Rick Nakroshis: "Multi-page TIFF's to PDF or DOC files"
    Date: Fri, 7 Nov 2003 23:58:24 -0700
    
    

    I would suggest handling the redirect back to no parameters done in the
    leftframe.cgi, not javascript. Something like:

    RightFrame.html --------------------------------------------------------
    <script language="JavaScript">
        function loadLeftFrame() {
            parent.leftFrame.location.href ="cgi-bin/cgifile.cgi?key=32"
        }
    </script>
    <input type="button" name="button1" Value="Load Left Frame"
    onClick="loadLeftFrame();"

    --------------------------------------------------------------------------

    LeftFrame.cgi ------------------------------------------------------------

    #!/usr/local/bin/perl
    use strict;
    use CGI qw(param);

    my $key = param('key');

    DBM stuff . . . . .

    if (defined $key) {
        print "Location: http://www.yoursite.com/cgi-bin/cgifile.cgi\n\n";
    }
    --------------------------------------------------------------------------

    Hope that makes sense.
    JH

    "Jack" <silencer2020@yahoo.ca> wrote in message
    news:20031108044745.81600.qmail@web60006.mail.yahoo.com...
    > Hi,
    >
    > I'm hoping someone can help me with a CGI problem I've
    > been having:
    >
    > I have two frames on my site. The left frame contains
    > a CGI script (and it's initially called with NO
    > parameters)
    > and the right frame contains an HTML file. There is a
    > button on the right frame that triggers
    > a javascript function that contains the following
    > line:
    >
    > parent.leftFrame.location.href =
    > "cgi-bin/cgifile.cgi?key=32";
    >
    > i.e. It calls the CGI on the left frame with a few
    > parameters.
    >
    > This CGI script accesses a DBM file and does something
    > similar to $dbm_file[$key]++
    >
    > Now if the user reloads this page using the
    > reload/refresh button of the browser, the
    > CGI script on the left hand side gets called with the
    > parameters that the javascript
    > function called it with. This has undesirable effect
    > of changing the DBM file.
    > I don't want the DBM file to be changed when the user
    > refreshes the page.
    >
    > i.e. When the user refreshes the page I want the CGI
    > script in the left frame to get
    > called with no parameters.
    >
    >
    > If I put something like this in the javascript
    > function, it works:
    >
    > parent.leftFrame.location.href =
    > "cgi-bin/cgifile.cgi?key=32";
    > alert('Cause some delay');
    > parent.rightFrame.location.href =
    > "../../../cgi-bin/orderStatus.cgi";
    >
    > For some reason I have to insert an alert box to cause
    > some delay between the invokation
    > of these CGI scripts, otherwise it doesn't work.
    >
    > Does anyone have any idea how I should solve this
    > problem? It would have been nice if the
    > above would work without the alert box.
    >
    > Any help would be greatly appreciated.
    >
    > Thanks,
    >
    > Jack
    >
    > ______________________________________________________________________
    > Post your free ad now! http://personals.yahoo.ca


  • Next message: Rick Nakroshis: "Multi-page TIFF's to PDF or DOC files"
  • Quantcast