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