You've got something jacked. DO NOT proceed with your coding using this hack. Put this in a blank file named whatever_you_want.php and hit it with your web browser. --------------------------------------------------------------------------- ----- <?php if ($_POST['action'] == 'Go') print_r($_POST); ?> <form action="<?=$_SERVER['SCRIPT_NAME']?>" method="POST"> <select name="my_select"> <option value="foo">foo</option> <option value="bar">bar</option> </select> <input type="submit" value="Go" name="action" class="button submit"/> </form> --------------------------------------------------------------------------- ----- > -----Original Message----- > From: Brian Dunning [mailto:brian@xxxxxxxxxxxxxxxx] > Sent: Wednesday, August 18, 2010 2:23 PM > To: PHP-General > Subject: Re: Can't read $_POST array > > This was the complete code of the page (this is the POST > version not the REQUEST version): > > <?php > $response = print_r($_POST, true); > echo $response; > ?> > > Returns an empty array no matter what POST vars are sent. We > fixed it by changing it to this, which I've never even heard > of, but so far is working perfectly: > > <?php > $response = file_get_contents('php://input'); > echo $response; > ?> > > I have no idea what the problem was. Thanks to everyone for your help. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
<?php if ($_POST['action'] == 'Go') print_r($_POST); ?> <form action="<?=$_SERVER['SCRIPT_NAME']?>" method="POST"> <select name="my_select"> <option value="foo">foo</option> <option value="bar">bar</option> </select> <input type="submit" value="Go" name="action" class="button submit"/> </form>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php