RE: [PHP] form field update
| From: | John Holmes | Date: | Mon, 17 Jun 2002 02:52:09 +0000 |
| Subject: | RE: [PHP] form field update | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-102459@lists.php.net to get a copy of this message | ||
So throw a little onchange= event into "machine_group" that submits the
form and then dynamically generates the <options> for "machine_type". In
order for the other form stuff to retain it's value, you have to put it
there.
<input type='text' name='whatever'
value='<?=$_POST['whatever']?>'>
When the form is first loaded, $_POST['whatever'] will be empty, so the
text box will be also. When the form is submitted, $_POST['whatever']
will contain the value in the text box, so if you have to redisplay the
form, now it'll be filled.
You may have to adjust your error_reporting() so you don't see an error
about Undefined Offset 'whatever' when you first load the page...
---John Holmes...
> -----Original Message-----
> From: Peter [mailto:php@vfsa.com.au]
> Sent: Sunday, June 16, 2002 10:45 PM
> To: Php
> Subject: RE: [PHP] form field update
>
> ok to make it clearer...
>
> <form ......>
> <other form stuff>
> <select name="machine_group" size="1" id="machine_group">
> <option value="ws" >Work Station</option>
> <option value="serv" >Server</option>
> <option value="stor">Storage</option>
> <option value="bu">Back Up</option>
> </select>
>
> <select name="machine_type" size="1" id="machine_group">
>
> the info in here needs to be gathered depending on what was selected
>
> <option value="$value" >$machine_type</option>
>
> </select>
> <more form stuff>
> </form>
>
> now what i want to do is have the option values in machine_type to
> automatically load depending on what was selected in machine_group
with
> the
> options in machine_type repeating until no more records are found
> matching.
> The repeating part i can do no worries .. hope this made sence
> **All other form info must be retained....**
> -----Original Message-----
> From: Martin Towell [mailto:martin.towell@world.net]
> Sent: Monday, 17 June 2002 11:46 AM
> To: 'Peter'; Php
> Subject: RE: [PHP] form field update
>
>
> depends on what's being updated (and where that info is coming from),
and
> if
> you're willing to allow the data the user has typed in to disappear
after
> a
> refresh
>
> -----Original Message-----
> From: Peter [mailto:php@vfsa.com.au]
> Sent: Monday, June 17, 2002 11:50 AM
> To: Php
> Subject: [PHP] form field update
>
>
> howdy,
>
> I am building a page that relies on a form...
> what I am unsure of is ..
> is it better to try and have form fields update them selves, using
java
> script or the like or have the whole page refreshed with out being
> submitted
> given there will be other data entered on the page..
>
>
> Cheers
>
> Peter
> "the only dumb question is the one that wasn't asked"
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php