[英]Echo Javascript Variable in Php to another page
I have code which passes php variable to another page on my site: 我有将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>';
I am able to retrieve the php variable $imageid by the following: 我可以通过以下方式检索php变量$ imageid:
$imageid = htmlentities($_GET['imageid']);
I want to also pass in this code the value of a javascript variable. 我还想在此代码中传递javascript变量的值。 The variable is set in an earlier part of the code as follows: 该变量在代码的前面部分中进行了如下设置:
var rowcount
I don't know how to pass var rowcount in the same echo code as I pass $imageid. 我不知道如何在传递$ imageid的相同回显代码中传递var rowcount。 What is the code to do this? 这样做的代码是什么?
How bout following: 如何追踪:
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>";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.