php params not getting called

2019-08-28 14:10发布

I have link as test.php?fullname=Fahim&emailid=test@test.com

In test.php I have below

$fullname = $_POST['fullname'];
$emailid = $_POST['emailid'];

echo "$fullname===$emailid===";

I always get response as ======

I was expecting as Fahim===test@test.com.

Any idea why this is happening?

标签: php param
3条回答
Anthone
2楼-- · 2019-08-28 14:38

In test.php data will be recieved using $_GET cause you are sending data using URL

查看更多
smile是对你的礼貌
3楼-- · 2019-08-28 14:41

Your link test.php?fullname=Fahim&emailid=test@test.com

$fullname = $_GET['fullname'];
$emailid = $_GET['emailid'];
echo "$fullname===$emailid===";

Output

Fahim===test@test.com

You have to use $_GET['param_name'] to retrive values sending via url.

查看更多
Lonely孤独者°
4楼-- · 2019-08-28 14:48

When you pass parameters from the url, it is a get request..

In PHP, we use $_GET for fetching information from get request

$fullname = $_GET['fullname'];
$emailid = $_GET['emailid'];

echo "$fullname===$emailid===";
查看更多
登录 后发表回答