NEWBIE: Perl CGI script that redirects to another webpage

T

Tester

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
 
M

Matt Garrish

Tester said:
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
 
T

Tad McClellan

Tester said:
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?
 
T

Tintin

Tester said:
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);
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top