dongqian1028
2016-12-30 18:43将HTML参数传递给php页面
I am attempting to pass the parameters of the current html page to the php page using a form. So far I have the following function inside my header in the html
<script>
function getURLParameter(name) {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [null, ''])[1].replace(/\+/g, '%20')) || null;
}
</script>
and then in the form I have the following
<input type="hidden" name="amtpaid" id="amtpaid" value="getURLParameter('amt')" />
<input type="hidden" name="status" id="sts" value="getURLParameter('st')" />
this is assuming a url such like
www.somehost.com/page/?amt=5&sts=CONFIRMED
however all that the php says is posted is the following (this is aa dump of all post data)
Array ( [on1] => Steam 32 - ID (STEAM_0:X:XXXX) [os1] => hj [amtpaid] => getURLParameter('amt'); [status] => getURLParameter('st'); )
anyhelp??
- 点赞
- 回答
- 收藏
- 复制链接分享
2条回答
为你推荐
- 如何使用<a href将多个变量传输到php页面
- html
- php
- 3个回答
- 如何在PHP中将值从一个页面传递到另一个页面,而不是通过URL?
- html
- mysql
- php
- 1个回答
- 如何通过ajax将id从url参数传递到另一个页面
- ajax
- php
- jquery
- 1个回答
- 幻影将php变量传递给js
- phantomjs
- javascript
- php
- 1个回答
- 将从函数调用中获取的数据传递给第二个PHP页面
- html
- forms
- php
- 2个回答
换一换