| Author |
losing variable in CGI.pm redirect
|
|
| Juleigha27@Gmail.Com 2008-01-22, 7:08 pm |
| Hi,
Hopefully this appropriate question for this group. I am trying to
redirect to a website:
print $query->redirect(-location=>test.cgi?ID=$value", -
method=>'GET');
Unfortunately the $value never gets passed and I end up with test.cgi?
ID= .
Thanks,
J
| |
| Yitzle 2008-01-22, 7:09 pm |
| Why do you only have one double-quote on that line?
Are you using strict and warnings?
print $query->redirect(-location=> "test.cgi?ID=$value", -method=>"GET");
On Jan 22, 2008 4:31 PM, juleigha27@gmail.com <juleigha27@gmail.com> wrote:
> Hi,
> Hopefully this appropriate question for this group. I am trying to
> redirect to a website:
>
> print $query->redirect(-location=>test.cgi?ID=$value", -
> method=>'GET');
>
> Unfortunately the $value never gets passed and I end up with test.cgi?
> ID= .
>
> Thanks,
> J
>
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> http://learn.perl.org/
>
>
>
| |
| Gunnar Hjalmarsson 2008-01-22, 7:09 pm |
| yitzle wrote:
> juleigha27@gmail.com wrote:
>
> Why do you only have one double-quote on that line?
> Are you using strict and warnings?
>
> print $query->redirect(-location=> "test.cgi?ID=$value", -method=>"GET");
And does $value contain a value?
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
| |
| Gunnar Hjalmarsson 2008-01-22, 7:09 pm |
| Gunnar Hjalmarsson wrote:
> yitzle wrote:
>
> And does $value contain a value?
Btw, the -method parameter makes no sense here, since this is not a form
submission. This should be enough:
print $query->redirect("mytest.pl?ID=$value");
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
| |
| Ron Bergin 2008-01-23, 8:07 am |
| On Jan 22, 1:31 pm, juleigh...@gmail.com (Juleigh...@Gmail.Com) wrote:
> Hi,
> Hopefully this appropriate question for this group. I am trying to
> redirect to a website:
>
> print $query->redirect(-location=>test.cgi?ID=$value", -
> method=>'GET');
>
> Unfortunately the $value never gets passed and I end up with test.cgi?
> ID= .
>
> Thanks,
> J
http://search.cpan.org/~lds/CGI.pm-...IRECTION_HEADER
quoted from the cpan doc:
"You should always use full URLs (including the http: or ftp: part) in
redirection requests. Relative URLs will not work correctly."
| |
| Juleigha27@Gmail.Com 2008-01-23, 8:07 am |
| On Jan 22, 4:36 pm, nore...@gunnar.cc (Gunnar Hjalmarsson) wrote:
> Gunnar Hjalmarsson wrote:
>
>
>
>
>
>
> Btw, the -method parameter makes no sense here, since this is not a form
> submission. This should be enough:
>
> print $query->redirect("mytest.pl?ID=$value");
>
> --
> Gunnar Hjalmarsson
> Email:http://www.gunnar.cc/cgi-bin/contact.pl
Thanks for the suggestions. $value does have a value and I am able to
print it before the redirect. I have also tried
print $query->redirect("mytest.cgi?ID=$value");
and I am still not getting the $value to show up.
| |
| Gunnar Hjalmarsson 2008-01-23, 7:06 pm |
| juleigha27@gmail.com wrote:
> Thanks for the suggestions. $value does have a value and I am able to
> print it before the redirect. I have also tried
> print $query->redirect("mytest.cgi?ID=$value");
> and I am still not getting the $value to show up.
Then show us a (short but) complete script, if you need more assistance.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
| |
| Tom Phoenix 2008-01-23, 7:06 pm |
| On Jan 22, 2008 8:51 PM, juleigha27@gmail.com <juleigha27@gmail.com> wrote:
> print $query->redirect("mytest.cgi?ID=$value");
> and I am still not getting the $value to show up.
Does the program here work for you when you run it from the command
line? In what important way does your program differ from this one?
#!/usr/bin/perl
use strict;
use warnings;
use CGI;
my $value = 'redirect_ID';
my $query = new CGI;
print $query->redirect("mytest.pl?ID=$value");
Hope this helps!
--Tom Phoenix
Stonehenge Perl Training
| |
| Juleigha27@Gmail.Com 2008-01-23, 7:06 pm |
| On Jan 22, 8:51 pm, juleigh...@gmail.com (Juleigh...@Gmail.Com) wrote:
> On Jan 22, 4:36 pm, nore...@gunnar.cc (Gunnar Hjalmarsson) wrote:
>
>
>
>
>
>
>
>
>
>
>
>
> Thanks for the suggestions. $value does have a value and I am able to
> print it before the redirect. I have also tried
> print $query->redirect("mytest.cgi?ID=$value");
> and I am still not getting the $value to show up.
Hi when using the full url:
print $query->redirect('http://site/cgi-bin/mytest.cgi?ID='.$value);
I am redirected to:
http://site/cgi-bin/mytest.cgi?ID=
| |
| Rob Dixon 2008-01-23, 10:07 pm |
| juleigha27@gmail.com wrote:
>
> Hi when using the full url:
> print $query->redirect('http://site/cgi-bin/mytest.cgi?ID='.$value);
> I am redirected to:
> http://site/cgi-bin/mytest.cgi?ID=
Change your code to read
$value = 'emptyID' unless $value;
print $query->redirect('http://site/cgi-bin/mytest.cgi?ID='.$value);
Is there any change in behaviour?
Rob
| |
| Juleigha27@Gmail.Com 2008-01-24, 8:06 am |
| On Jan 23, 9:14 am, t...@stonehenge.com (Tom Phoenix) wrote:
> On Jan 22, 2008 8:51 PM, juleigh...@gmail.com <juleigh...@gmail.com> wrote:
>
>
> Does the program here work for you when you run it from the command
> line? In what important way does your program differ from this one?
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
> use CGI;
>
> my $value = 'redirect_ID';
> my $query = new CGI;
> print $query->redirect("mytest.pl?ID=$value");
>
> Hope this helps!
>
> --Tom Phoenix
> Stonehenge Perl Training
It is just this certain variable for some reason. I am able to get it
working with another variable. Thanks for the help.
|
|
|
|