galbax
By:
galbax

LAMP $_POST doesnt work or is empty

December 28, 2014 1.2k views

Hi,
I have a Droplet with the application LAMP. My big problem is that I can't get any data from POST.

<html>
<body>

Welcome <?php echo $_POST["name"]; ?><br>

</body>
</html>

Returns only "Welcome " with this link: X.X.X.X\page.php?name=test

Do you have any Idea? I tried to set up LAMP on my own and this also didn't work.

1 Answer

To the access the URL's query string (name=test), you need to use $_GET instead of $_POST:

<html>
<body>

Welcome <?php echo $_GET["name"]; ?><br>

</body>
</html>
Have another answer? Share your knowledge.