将Php中的Javascript变量回显到另一个页面


Echo Javascript Variable in Php to another page

我有代码可以将php变量传递到我网站上的另一个页面:

echo'<a class="btn btn-danger" style="margin-left:10px;width:120px;float:left;"  href="fullsizemarket.php?imageid=',$imageid,'&action=removed">Remove from Cart</a>';

我能够通过以下方式检索php变量$imageid:

$imageid = htmlentities($_GET['imageid']);

我还想在这段代码中传递一个javascript变量的值。变量设置在代码的前一部分,如下所示:

     var rowcount

我不知道如何在传递$imageid的同一个echo代码中传递var rowcount。执行此操作的代码是什么?

以下内容如何:

echo 
"<a class='btn btn-danger' 
    style='margin-left:10px;width:120px;float:left;' 
    href='fullsizemarket.php?imageid=$imageid&action=removed&rowcount='
    onclick = '" this.setAttribute('href', this.getAttribute('href')+rowcount) '"
 >Remove from Cart</a>";