NEWBIE: Perl CGI script that redirects to another webpage

Discussion in 'Perl Misc' started by Tester, Jan 4, 2005.

  1. Tester

    Tester Guest

    Hi There,

    I think this is very simple. I need to write a PERL script that a form is
    submitted to it, one of the forms input parameters is a URL.

    Once the script has done some other processing, it redirects the users
    browser to the URL.

    E.g.
    Webpage is Form submission.
    User presses submit and it sends over form details including one (hidden)
    field called URL
    PERL script processes the form and then redirects browser to the URL field

    I hope that makes sense and I am sure that is easy to do but I am not sure
    how.

    Kind regards and thanks in advance.

    Dave
     
    Tester, Jan 4, 2005
    #1
    1. Advertisements

  2. Tester

    Matt Garrish Guest

    "Tester" <SPAM FREE WORLD> wrote in message
    news:41db2985$...
    > Hi There,
    >
    > I think this is very simple. I need to write a PERL script that a form is
    > submitted to it, one of the forms input parameters is a URL.
    >
    > Once the script has done some other processing, it redirects the users
    > browser to the URL.
    >


    Please see the perlfaqs for why you should never write PERL.

    I have no idea why you would pass the final url around in a hidden field,
    but the solution to your problem lies with the http header you send. Print
    the correct ***redirect*** to that url and all will be well...

    Googling on "perl cgi redirect" will also show you that this question has
    been answered many, many times now.

    Matt
     
    Matt Garrish, Jan 4, 2005
    #2
    1. Advertisements

  3. Tester <> wrote:

    > Subject: NEWBIE: Perl CGI script that redirects to another webpage



    Have you seen the Posting Guidelines that are posted here frequently?


    > I think this is very simple.



    Then you should look for it in the Perl FAQ *before* posting
    to the Perl newsgroup!


    > Once the script has done some other processing, it redirects the users

    ^^^^^^^^
    > browser to the URL.



    perldoc -q redirect

    How do I redirect to another page?


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Jan 5, 2005
    #3
  4. Tester

    Tintin Guest

    "Tester" <SPAM FREE WORLD> wrote in message
    news:41db2985$...
    > Hi There,
    >
    > I think this is very simple. I need to write a PERL script that a form is
    > submitted to it, one of the forms input parameters is a URL.
    >
    > Once the script has done some other processing, it redirects the users
    > browser to the URL.
    >
    > E.g.
    > Webpage is Form submission.
    > User presses submit and it sends over form details including one (hidden)
    > field called URL
    > PERL script processes the form and then redirects browser to the URL field
    >
    > I hope that makes sense and I am sure that is easy to do but I am not sure
    > how.
    >
    > Kind regards and thanks in advance.


    #!/usr/bin/perl
    use strict;
    use CGI;

    my $q = new CGI;
    my $url=$q->param('url');
    print $q->redirect($url);
     
    Tintin, Jan 5, 2005
    #4
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wet Basement
    Replies:
    1
    Views:
    2,795
    BobMonk
    Jul 15, 2003
  2. dpackwood
    Replies:
    3
    Views:
    2,151
  3. praba kar

    Python-cgi or Perl-cgi script doubt

    praba kar, Jul 30, 2005, in forum: Python
    Replies:
    1
    Views:
    1,110
    Michael Sparks
    Jul 30, 2005
  4. Petterson Mikael

    Execute another perl script from my perl script

    Petterson Mikael, Jan 5, 2005, in forum: Perl Misc
    Replies:
    3
    Views:
    275
    Paul Lalli
    Jan 5, 2005
  5. Replies:
    20
    Views:
    1,294
    Gunnar Hjalmarsson
    Jan 18, 2005
  6. vikrant
    Replies:
    4
    Views:
    441
  7. PhEaSaNt PLuCKeR

    perl script to pass data to another perl script?

    PhEaSaNt PLuCKeR, Oct 30, 2005, in forum: Perl Misc
    Replies:
    1
    Views:
    268
  8. kath
    Replies:
    4
    Views:
    1,117
    J. Gleixner
    Apr 9, 2007
Loading...