将变量传递给另一个文件[关闭]

问题描述 投票:-4回答:1

我有两个文件(A.html,B.php)。 A.html有一些按钮。单击一个按钮时,我想将一个带有按钮id的变量传递给B.php。我怎么能这样做?

javascript php jquery html buttonclick
1个回答
0
投票

这2个文件应位于同一位置,并在您的服务器中安装php

A.html

...
<a href="B.php?data1=1654&data2=string">Button</a>
...

B.php

<?php

echo $_GET['data1']; // output "1654"
echo $_GET['data2']; // output "string"
© www.soinside.com 2019 - 2024. All rights reserved.