Multiple $_GET from a link parameters

旧城冷巷雨未停 提交于 2019-12-01 07:49:02

问题


I'm sending values to php file using js like that:

validation.php?firstName=test?lastName=test?email=test?contactNumber=test?title=test?description=test

And in validation.php I've created array with these values like that:

$data[0] = $_GET['firstName'];
$data[1] = $_GET['lastName'];
$data[2] = $_GET['email'];
$data[3] = $_GET['contactNumber'];
$data[4] = $_GET['title'];
$data[5] = $_GET['description'];

unfortunately php returns me errors, why?


回答1:


? indicates the start of a query string but key/value pairs within it are separated with & or (less commonly) ;.




回答2:


You need to separate them with the ampersand sign:

validation.php?firstName=test&lastName=test&email=test&contactNumber=test&title=test&description=test



回答3:


Use the & instead of the ? in the url between variables.




回答4:


your URL is wrong. Make it like:

validation.php?firstName=test&lastName=test&email=test&contactNumber=test&title=test&description=test


来源:https://stackoverflow.com/questions/9387481/multiple-get-from-a-link-parameters

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!