Re: [PHP] using variable in php form before the form is POSTed

[email protected] (tedd)
Newsgroups php.general
Message-ID <p06240806c44f40c86ec6@[192.168.1.101]>
At 2:44 PM -0700 5/12/08, milt wrote:
>I have a form that will be filled in by the user, I want to have access to
>the content of one of the fields in that form, in order to fill in an
>another variable that is not part of the form.  this variable is used by a
>routine when the form is "posted".  Question - is the $_post[field name]
>availble before the submit button is pushed, or is there another way to get
>the contents of the field?
>thanks, Milt

Use hidden, such as:

<input type="hidden" name="step" value="1">

After the form is posted, $_POST['step'] will = 1.

I use this technique all the time so that I can use the same script 
to present different forms based upon which step in the form 
processing the user is on (i.e., step=1, step=2, step=3 and so on).

Cheers,

tedd

-- 
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.