Re: Access name of variable in $_POST array

From: Date: Fri, 21 Sep 2007 22:11:56 +0000
Subject: Re: Access name of variable in $_POST array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-262355@lists.php.net to get a copy of this message
Please include the list when replying. Eric Lommatsch wrote:
-----Original Message----- From: Stut [mailto:stuttle@gmail.com] Sent: Friday, September 21, 2007 3:09 PM To: Eric Lommatsch Cc: php-general@lists.php.net Subject: Re: [PHP] Access name of variable in $_POST array Eric Lommatsch wrote:
I am writing a PHP script that is going to accept variables that are passed from a PDF form and should write both the name of the variable and its value to a text file. I can get the value that I want to retrieve with out problem. However, even though I have searched through the PHP.net site and googled this as well I have not yet been able to find the syntax that I need to get the names of the variables in the $_Post array. Can someone point me to the place in the PHP manual where I can find the syntax to get the name of a variable in the $_POST array?
http://php.net/array_keys As in... $varnames = array_keys($_POST); -Stut -- http://stut.net/ Hello Stut, That is not exactly what I am looking for. If I try using that in My PHP script what I get as a result of that is repeatedly the Phrase "Post Array" when I check the values there. The PDF form that is posting to the PHP script is passing variable names like "Employer_name" or "Employee_Name". I am hoping to get those variable names.
Put this line at the top of the script that the form posts to... print '<pre>'.print_r($_POST, true).'</pre>'; exit; That will display the contents of the $_POST array and you should be able to figure out where everything is. By the sounds of it the posted values are actually in $_POST['Post Array'] but use the above line to be sure. -Stut -- http://stut.net/

« previous php.general (#262355) next »