我有一个表单,我必须发送一些值(文本框的值)而不是POST
, 我必须通过GET
来完成。如何通过url发送文本框的值
这是我的代码:
<a class="btn btn-warning btn-sm" href="insertcot.php?pais=document.getElementById('pais').value&proyecto=document.getElementById('proyecto').value¬as=document.getElementById('notas').value&formapago=document.getElementById('formapago').value&fechaentrega=document.getElementById('fechaentrega').value&flete=document.getElementById('flete').value&instalacion=document.getElementById('instalacion').value&venta=document.getElementById('venta').value&total=document.get
ElementById('total').value">Realizar</a>
在insertcot.php
我打印显示GET
:
<?php
echo "<pre>";
print_r($_GET);
echo "</pre>";
?>
,我看到它
Array
(
[pais] => document.getElementById('pais').value
[proyecto] => document.getElementById('proyecto').value
[notas] => document.getElementById('notas').value
[formapago] => document.getElementById('formapago').value
[fechaentrega] => document.getElementById('fechaentrega').value
[flete] => document.getElementById('flete').value
[instalacion] => document.getElementById('instalacion').value
[venta] => document.getElementById('venta').value
[total] => document.getElementById('total').value
)
正如我所看到的,我不是获取值...
我该怎么做才能得到它们
您不能在URL中执行JavaScript函数。您必须获取变量并将其正确添加到URL中。 – 2014-11-06 20:03:16
为什么你期望JavaScript在'href'属性内执行?你需要编写一个实际的脚本来做你想做的事情。 – Barmar 2014-11-06 20:03:17
那我该怎么做呢? – 2014-11-06 20:06:23