以Php lost @ character提交表格

时间:2012-08-06 10:28:37

标签: php javascript forms

我的形式有一个非常奇怪的问题,不知道如何解决它。试过一次搜索,却一无所获。我有一个表单,我在PHP页面中使用$ get接收数据来处理数据。奇怪的是,当我在像电子邮件这样的字段中插入@时,@在发送数据的过程中丢失了。我在重定向到php页面之前在行中验证了如果@在那里它是,所以我不知道这个字符在这个过程的下一步中丢失了。

任何提示?

重定向来自我点击提交表单时调用的javascript函数:

window.location.href = 'index.php?pagina=candidaturasB&'+ qstringA;

“qstringA”包含我的表单的所有数据,如果在某些输入中我放了一个@,如果我在de重定向行之前做警告(qstringA),那么@在那之后,在url中,我收到数据的php页面没有@。

ex:index.php?...& email =“ren@something.com”出现在网址“index.php?...& email =”rensomething.com“。

1 个答案:

答案 0 :(得分:1)

对每个表单数据使用urlencode()

例如:

$url = "index.php?pagina=candidaturasB";
$url .= "&email=".urlencode($_GET['email']);
$url .= "&data="urlencode($_GET['data']);

并将结果字符串传递给window.location.href