简体   繁体   English

可以使用锚标记运行perl脚本吗?

[英]It is possible to run the perl script using anchor tag?

My HTML code is 我的HTML代码是

<a href="pdbstorage.pl" name="tim">TIM protein</a>

My perl script is 我的Perl脚本是

use CGI;
$cgi = CGI -> new();
$n = $cgi->param ("tim");
print "$n";

How to post the name into the perl script. 如何将name到perl脚本中。

To add the "name" parameter to the link, your html should be 要将“ name”参数添加到链接,您的html应该是

<a href="pdbstorage.pl?name=tim" name="tim">TIM protein</a>

Note here the "?name=tim"; 注意这里的“?name = tim”; this portion of the url is known as the query string 网址的这一部分称为查询字符串

To read that value, your perl code should be: 要读取该值,您的perl代码应为:

use CGI;
$cgi = CGI -> new();
$n = $cgi->param ("name");
print "name is $n";

You are looking for the value of the "name" parameter, which is "tim". 您正在寻找“名称”参数的值,即“ tim”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM