passing variables

Posted on 2001-08-16
Last Modified: 2010-03-05
I'm using a form which contains a link. (<a href></a>)
When a user clicks on this link, I want to pass some form values to my perl file. Now I want to read this parameters out in perl with :


and not with:
$ARGV[0] =~ s/\W//g;
$ARGV[1] =~ s/\W//g;

How to do this ?

Ps. I want to have a link <a href></a>, not a submit button.
Question by:michael123199

Accepted Solution

christopher sagayam earned 100 total points
ID: 6395183

Author Comment

ID: 6395198
I want to read it out with:

not with:
$ARGV[0] =~ s/\W//g;
$ARGV[1] =~ s/\W//g;

Expert Comment

by:christopher sagayam
ID: 6395206
you can read it out like that using my method
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline


Expert Comment

by:christopher sagayam
ID: 6395208
you want to read variables passed to your cgi script isnt it ?

Expert Comment

ID: 6395286
chris18 is 100% correct.

the only drawback to that method is it only submits the link and not other form data...

I mention this only because otherwise you should have already accepted his answer.

if you want the link data to submit WITH a form, put hidden fields in the form and use this cute little script.

here is an example.

as long as you make enough hidden fields for your values, this will work.

more, it is kindof neat.
it changes the names and the values of the fields, so it should work flawlessly in any browser.

although, chris18 really answered your question, try this anyways...right now the text fields are type text, not type hidden, so you can see it work. and the submit part is also commented if you want to send it to your cgi you'll need to change that.

function sendQS(an)
tArr=new Array()
values=new Array()
keys=new Array()
for(i in tArr)
for(v in values)
eval("document.forms['formName'].elements['" + base + v + "'].name=keys[v]")
eval("document.forms['formName'].elements['" + base + v + "'].value=values[v]")

      <P><A HREF="key1=value1&key2=value2&key3=value3"
          ONCLICK="sendQS(this);return false">click to send</A> </P>
      <FORM NAME="formName" METHOD="POST" ACTION="">
          <INPUT TYPE="TEXT" NAME="hiddenField0">
          <INPUT TYPE="TEXT" NAME="hiddenField1">
          <INPUT TYPE="TEXT" NAME="hiddenField2">
<INPUT TYPE="TEXT" NAME="hiddenField3">
<INPUT TYPE="TEXT" NAME="hiddenField4">
<INPUT TYPE="TEXT" NAME="hiddenField5">
           </FORM> </BODY>
LVL 51

Expert Comment

ID: 6395838
how about simply using in your page:

   <INPUT TYPE=hidden NAME=qn1 VALUE=whatever>

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Reading fields from the text file. 4 85
Perl 101 11 68
Add additional column to .csv using Perl. 8 120
Using Perl DBI to query oracle 3 30
I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now