RE: Access name of variable in $_POST array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Dan,

First off I am sorry for not getting back to you sooner, I had a weekend and
was not checking my work email

The reason that I want both the name of the variable and the value of the
variable is because what I need to do is create a text file that another
program I am integrating with is already designed to work with. If I am not
putting the field names in the file along with the data this other program
ignores the file I am creating. What I need as an output is something that
looks similar to:

FirstName	:	Eric
LastName	:	Lommatsch

The point of the script that I am writing is that I want it to be capable of
handling several different PDF forms.

Thank you
 
Eric H. Lommatsch
Programmer
360 Business 
2087 South Grant Street
Denver, CO 80210
Tel 303-777-8939
Fax 303-778-0378
 
ericl@xxxxxxxx

-----Original Message-----
From: Dan Parry [mailto:dan@xxxxxxxxxxxxxxxxxxx] 
Sent: Saturday, September 22, 2007 6:26 PM
To: 'Daniel Brown'; 'Stut'
Cc: Eric Lommatsch; php-general@xxxxxxxxxxxxx
Subject: RE:  Access name of variable in $_POST array

> -----Original Message-----
> From: Daniel Brown [mailto:parasane@xxxxxxxxx]
> Sent: 21 September 2007 23:27
> To: Stut
> Cc: Eric Lommatsch; php-general@xxxxxxxxxxxxx
> Subject: Re:  Access name of variable in $_POST array
> 
> On 9/21/07, Stut <stuttle@xxxxxxxxx> wrote:
> > Please include the list when replying.
> >
> > Eric Lommatsch wrote:
> > > -----Original Message-----
> > > From: Stut [mailto:stuttle@xxxxxxxxx]
> > > Sent: Friday, September 21, 2007 3:09 PM
> > > To: Eric Lommatsch
> > > Cc: php-general@xxxxxxxxxxxxx
> > > Subject: Re:  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/
> >
> > --
> > PHP General Mailing List (http://www.php.net/) To unsubscribe, 
> > visit: http://www.php.net/unsub.php
> >
> >
> 
>     Maybe this will get you started and give you some ideas.
> 
> <?
> foreach($_POST as $p => $v) {
>     $$p = $v;
>     echo $p." = ".$v."\n";
> }
> ?>

I might be missing something but I fail to see the point of the variable
variable assignation (which is best to be avoided :) )

Dan

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux