Forum Moderators: coopster & phranque

Message Too Old, No Replies

trouble moving from post to get with perl

         

lindajames

5:04 pm on Mar 15, 2003 (gmt 0)

10+ Year Member



Hi, I was wondering if anyone can help me. Basically i have this billing application and it lets customers view their invoices. but for customers to view their invoices they have to click on an image submit button. Example below:

<form action="accview.pl" method="post">
<input type="hidden" name="sid" vaue="2425223">
<input type="hidden" name="accid" vaue="test">
<input type="hidden" name="invid" vaue="162">
<input type="image" name="cmdinv" src="invoice.gif">
</form>

it also works if i try to post the form like this:

<form action="accview.pl?sid=2425223&accid=test&invid=162" method="post">
<input type="image" name="cmdinv" src="invoice.gif">
</form>

however, instead of using an image for submitting it, i wanted to link a text to it in the following way:

accview.pl?sid=2425223&accid=test&invid=162&cmdinv

but it doesnt seem to work.

I would be greatful if someone can help me out.

Cheers
Linda

jatar_k

5:14 pm on Mar 15, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



is it the way your script accesses the vars through post? You are moving to a get string so that could be the problem.

lindajames

5:19 pm on Mar 15, 2003 (gmt 0)

10+ Year Member



So if the script accesses the vars through post isnt there no way around it?

jatar_k

5:22 pm on Mar 15, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I am not the best one to help with perl syntax but the premise is that if you are explicitly accessing through the posted associative array then you would have to change that to access the variable string in the url.

If you plan on swapping back and forth then you would need to test to see if the vars were posted and if not then access the get string.

dive into perl

6:18 pm on Mar 15, 2003 (gmt 0)

10+ Year Member



Without seeing the Perl code it is hard to comment, but the best way to parse vars is by using the param function within the CGI.pm [search.cpan.org] module, which works for both POSTS and GETS.


#!/your/path/to/perl -w

use strict;
use CGI qw(:standard);

# protect against file upload
# denial of service attacks
$CGI::DISABLE_UPLOADS = 1;

my $q = new CGI;

print $q->header;
print $q->param('invid');