in reply to Re: Input button question
in thread Input button question

Yes, that is exaclty what I want to do, and I do want to do it each time that button is pushed.

Think you could provide an example? The code in the first reply isn't working for me - it only prints those statements out to the .pl page.

Replies are listed 'Best First'.
Re: direction
by ChemBoy (Priest) on Apr 19, 2001 at 20:46 UTC

    I'm still not quite clear on the sequence of events, but I'm going to put what I think is happening and then what I think you should do (this is what we call "error propagation" in my line of work...)

    1. Point browser to FOO.html
    2. submit form to BAR.pl
    3. BAR.pl modifies FOO.html
    4. Browser is redirected to FOO.html

    Is that right? If so, then the first suggestion is more or less right (for the "less", see use CGI or die;). The key is that those statements must be the first and only things printed to STDOUT by BAR.pl--if you print out a regular header first (using the header() method from CGI.pm), then it will just become part of the document body.

    Since I've made a fair passel of assumptions so far, I'll go ahead and assume you're using CGI.pm, as well. In which case, replace your call to print header("text/html"); with one to print redirect($new_url); and all will be well.

    I hope some of this is helpful--if my assumptions are totally off, we can go another round. :-)



    If God had meant us to fly, he would *never* have give us the railroads.
        --Michael Flanders

      If FOO.html is meant to be dynamic, then perhaps what you might want to do is put the FOO.html contents in BAR.pl and have BAR.pl print the FOO contents, which would change depending on the form field contents.

      This way you don't have to maintain/edit the FOO.html file seperately (and updating the static page could get ugly... so if you do this contemplate using a perl templating module)

      also, what if more than one person is using the site? Modifying FOO.html in a multi-user environment could be a flocking pain in the rear :-)

      I believe this is a reasonable interpretation, but the explaination and lack of any substantial code example has made this rather convoluted.

      -THRAK
      www.polarlava.com
Re: Re: Re: Input button question
by THRAK (Monk) on Apr 19, 2001 at 20:32 UTC
    You would be better off posting what you have and what it is you are trying to accomplish. You can do a redirect using something like:
    print $cgi->redirect($cgiurl);.
    This is functionally equivalent to what suaveant has above.
    You can learn more about the CGI module here.

    -THRAK
    www.polarlava.com
Re: Re: Re: Input button question
by suaveant (Parson) on Apr 19, 2001 at 21:28 UTC
    Probably what is happening is you are printing out other headers above the redirect headers...

    leave out the normal print "Content-Type: text/html\n\n"; or whatever you use and use mine... or if you are using CGI.pm, use the redirection routine that was pointed out below.
                    - Ant