0

I have a simple test form in html responseTest.html

<html>
    <body>
        <form action="catchResponse.php" method="POST">
            <input type="hidden" name="test" value="not empty" />
        </form>
    </body>
</html>

And I've got a simple catchResponse.php:

<?
include('config.php');
$obj=file_get_contents('php://input');
$fp=fopen('response2.txt','w+');
fwrite($fp,print_r($obj));
?>

If I run responseTest.html, response2.txt is empty. I'm clearly missing something basic here but cannot find it.

4
  • 1
    You will find the values in the $_POST array. Commented Sep 17, 2018 at 11:45
  • 1
    https://stackoverflow.com/questions/8893574/php-php-input-vs-post Commented Sep 17, 2018 at 11:45
  • Thanks for the pointers, this was doing the trick: enctype='application/json' Commented Sep 17, 2018 at 11:57
  • echo $_POST['test']; Commented Sep 17, 2018 at 13:37

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.