gpt4 book ai didi

html - 在 bash 中使用脚本获取列表框的值

转载 作者:太空宇宙 更新时间:2023-11-04 11:52:24 24 4
gpt4 key购买 nike

我有这段代码:

#!/bin/bash


echo "Content-type: text/html"
echo ""

echo '
<html>
<head>
<meta http-equiv="Content-Type" content="test/html"; charset=UTF-8">
<title> CLUSTER GRAPH </title>
<h1> Cluster Graph </h1>
<hr size="4" color="blue">
</head>

<body>

<p> Choose a Cluster and press the button to generate the graph ! </p>

<form action="script_extract.sh">
<select name="cluster" >
<option value="Cluster_ALE01">CLUSTER 1</option>
<option value="Cluster_AMR01">CLUSTER 1</option>
</select>
<br><br>
<input type="submit" value="Generate">
</form>

</body>
</head>
</html> '

你能告诉我如何恢复我在列表框中选择的值以在新页面中找到她吗?

例如,我希望打开一个新选项卡(我知道如何做到这一点没有任何问题),例如句子

"Cluster chosen : *Cluster choose in my list box*

如何在我选择集群的第一页与打开并显示我的句子“Cluster choosen : *Cluster choose in my listbox”的页面之间创建链接?

谢谢! :)

最佳答案

将 method=GET 放在表单中。

script_extract.sh 需要:

#!/bin/bash
echo "Content-type: text/html"
echo ""

echo '<html>'
echo '<head>'

if [ -z "$QUERY_STRING" ]; then
exit 0
else
saveIFS=$IFS
IFS='&'
eval $QUERY_STRING
IFS=$saveIFS
fi

echo "$cluster

PS:有些配置只接受 .cgi 文件。参见 httpd.conf 或 apache.conf

关于html - 在 bash 中使用脚本获取列表框的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55650845/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com