0
我编码URL的使用JavaScript的当表单提交encodeURIComponent()功能:的Javascript decodeURIComponent()与PHP
<form name="form" action="actions.php" method="post">
<input type="text" name="url" id="url" value="http://">
<script type="text/javascript">
function encodeLinks(){
var e = document.getElementById('url')
e.value = encodeURIComponent(e.value);
}
</script>
<button type="submit" class="btn btn-primary" onclick="encodeLinks()">Submit</button>
</form>
什么是最有效的方式来获得这些数据返回到行动网页JavaScript才能解码它,然后在mysql查询中使用它?
* urldecode *这是你在看什么? –
为什么你需要这样做?提交表单时,输入会自动编码。 – Barmar