Multiple $_GET from a link parameters

2020-03-26 06:00发布

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?

4条回答
爱情/是我丢掉的垃圾
2楼-- · 2020-03-26 06:19

You need to separate them with the ampersand sign:

validation.php?firstName=test&lastName=test&email=test&contactNumber=test&title=test&description=test
查看更多
Luminary・发光体
3楼-- · 2020-03-26 06:29

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

查看更多
老娘就宠你
4楼-- · 2020-03-26 06:33

your URL is wrong. Make it like:

validation.php?firstName=test&lastName=test&email=test&contactNumber=test&title=test&description=test
查看更多
ら.Afraid
5楼-- · 2020-03-26 06:34

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

查看更多
登录 后发表回答