Re: passing a variable.
| From: | Matt McClanahan | Date: | Thu, 08 Jun 2000 03:13:42 +0000 |
| Subject: | Re: passing a variable. | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-257@lists.php.net to get a copy of this message | ||
On Wed, 7 Jun 2000, Mark McCray wrote:
> Hey there,
> I'm sure how to go about doing something.
>
> I want users to come to a page where they enter their phone extension.
>
> Once they enter their extension, and hit submit, it should then bring them
> to a second page.
>
> What happens on this second page is this:
>
> It will create a form for them to fill out. But certain information will
> automatically be filled out like first name, last name, dept, and title.
> Because it looks up to a employee table to find that information out.
>
> The problem I'm having is that I don't know how to get the extension that
> was entered in the first page to appear in the url for the second page once
> you hit submit (on the first page).
>
> the url should look something like
> http://monster/histinfo.php?extension=1114
Given a proper PHP setup (The default config qualifies as proper :) ) any
form fields defined will be converted to PHP variables automatically when
a script is used for the submission.
So if you have <input type=text name=extension> in the first script, then
the script that you submit the form to will have an $extension variable
set. If you use the POST method for the form, the form variables won't
show up in the URL string. They will, however, if you use the GET method.
If the second script also has a form that you want the extension to be
filled in by default, you would want to use
<input type=text name=extension value="<?= $extension ?>">
HTH,
Matt