[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 225
  • Last Modified:

passing variables

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.
1 Solution
christopher sagayamCommented:
michael123199Author Commented:
I want to read it out with:

not with:
$ARGV[0] =~ s/\W//g;
$ARGV[1] =~ s/\W//g;
christopher sagayamCommented:
you can read it out like that using my method
[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

christopher sagayamCommented:
you want to read variables passed to your cgi script isnt it ?
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 out...so 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="http://www.yoursite.com">
          <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>
how about simply using in your page:

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

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now