我正在使用此网址更改代码中的Price值。

http://yoursite.com/mycart.php?am=20&product=Digitizing

我希望每当我更改url中的am=值时,都必须根据该代码动态地更改代码中的value='0'

<input type='hidden' name='li_1_price' value='0' />
分析解答

您只需要使用PHP截取值,然后将变量写入代码即可。

<?php $amValueIs = $_GET["am"]; ?>

然后在您的HTML中

<input type='hidden' name='li_1_price' value='<?php echo $amValueIs; ?>' />

这里的所有都是它的。

根据评论编辑: 如果要确保"am"具有一个值,那么就不会发出警告:

$amValueIs = isset($_GET["am"]) ? $_GET["am"] : "0";

这是"if it's set then use it, if not give it a 0"的简写。 我还将该"php"添加到另一个打开的标签中,以防万一。