Question

LAMP $_POST doesnt work or is empty

Posted December 28, 2014 2.3k 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.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
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>
Submit an Answer