php params not getting called

2019-08-28 14:41发布

问题:

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?

回答1:

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



回答2:

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.



回答3:

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===";


标签: php param