Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script.cgi?delete=1001 and send 1001 to a sub ?

Status
Not open for further replies.

PasPy

Programmer
May 16, 2002
11
CA
# ok, the probleme is went i am in the html page of the cgi
# I could click on a link "# bin/script.gci?delete=1001, so this recall the same script

# my trouble is at the head of the script when the cgi
# decide which sub will be start...

$referer = $ENV{HTTP_REFERER};
if (($action eq "checklogin") && ($referer ~ "$scripturl")) {
&check_login;
}
elsif (($action eq "delete") && ($referer =~ "$scripturl")) {
&delete;
}
elseif

&main;

}

so when i call script.cgi?delete=1001 ;the scripts don't refer to delete scripts because $action = "delete=1001"

so i want to send the variable 1001 to the sub delete.
and the link to &quot;script.cgi?delete=1001 &quot; is in a html page, i would know if i need to pu <method=post> or something like this in the head of the html

thank you very much

I wish you will understand, it's hard to explain in a text!
 
Hi PasPy,

Somewhere in your script you are parsing the data that was passed to the script on the second call, most likely using a split function. Usually the QUERY_STRING. get_form_data is a typical parse routine for this. There are more elegant ways using Perl Modules, don't know the names offhand

It looks like the variable delete has the value 1001

You need to be passing something like script.cgi?action=delete&deleteparam=1001


Hope this helps
;P
 
Try replacing
[tt]elsif (($action eq &quot;delete&quot;) && ($referer =~ &quot;$scripturl&quot;)) {
&delete;[/tt]
with
[tt]elsif (($action =~ /^delete/) && ($referer =~ &quot;$scripturl&quot;)) {
$action =~ /^delete=([\d+])/ && delete($1)
[/tt]
and then modify the delete sub to take an argument.


----------------------------------------------- &quot;As soon as we started programming, we found to our surprise that it wasn't as
easy to get programs right as we had thought. Debugging had to be discovered.
I can remember the exact instant when I realized that a large part of my life
from then on was going to be spent in finding mistakes in my own programs.&quot;
--Maurice Wilk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top