Dynamic Pick list question.

9 views
Skip to first unread message

Mark Winter

unread,
Feb 18, 2006, 2:48:27 PM2/18/06
to
Hello,

I am wondering if someone could point me in the right direction to
figure out how to create a dynamic form. I have been developing
programs in perl and oracle and have recently switched to php.

I need to create a form that has four of five seperate pick list on it.

Each item in each of the pick list depend on the users previous entry.
For instence if the user picks Ford then Taurus, Ranger, Focus,.etc show
up in the next pick list then the user picks Ranger and 2 wheel drive, 4
wheel drive, etc show in the next pick list box on so on.

I know how to this if the screen is refresed after each user entry. What
I would like to fugure out how to make the screen automatically update
each pick list and not refreshing the whole screen.


Any help or instruction would be great!

Thanks

Mark

Jerry Stuckle

unread,
Feb 18, 2006, 2:55:26 PM2/18/06
to

Mark,

You can't do this in PHP. PHP is client-side only; to do it without
refreshing would require all the info be sent to the client, then
processed by a client-side language such as javascript.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstu...@attglobal.net
==================

Mark Winter

unread,
Feb 18, 2006, 3:08:01 PM2/18/06
to
Right,

I know you have to use server side javascript, but how?...

Jerry Stuckle

unread,
Feb 18, 2006, 6:52:00 PM2/18/06
to

No, javascript it client side. So you need to use something like PHP
for the server side processing, and javascript for the client side.

noone

unread,
Feb 18, 2006, 7:57:43 PM2/18/06
to
Jerry Stuckle wrote:
> Mark Winter wrote:
>
>> Hello,
>>
>> I am wondering if someone could point me in the right direction to
>> figure out how to create a dynamic form. I have been developing
>> programs in perl and oracle and have recently switched to php.
>>
>> I need to create a form that has four of five seperate pick list on it.
>> Each item in each of the pick list depend on the users previous entry.
>> For instence if the user picks Ford then Taurus, Ranger, Focus,.etc
>> show up in the next pick list then the user picks Ranger and 2 wheel
>> drive, 4 wheel drive, etc show in the next pick list box on so on.
>>
>> I know how to this if the screen is refresed after each user entry.
>> What I would like to fugure out how to make the screen automatically
>> update each pick list and not refreshing the whole screen.
>>
>>
>> Any help or instruction would be great!
>>
>> Thanks
>>
>> Mark
>
>
> Mark,
>
> You can't do this in PHP. PHP is client-side only; to do it without
> refreshing would require all the info be sent to the client, then
> processed by a client-side language such as javascript.

Minor correction: PHP is SERVER-side ONLY

>
>

Jerry Stuckle

unread,
Feb 18, 2006, 8:49:33 PM2/18/06
to

Yep, sorry :-)

samudasu

unread,
Feb 18, 2006, 11:53:58 PM2/18/06
to

dbee

unread,
Feb 19, 2006, 6:07:53 AM2/19/06
to
You could try it with javascript.
But you'd be talking about a quite large and complex javascript file.

I'd go with AJAX if I were you.

Mark Winter

unread,
Feb 19, 2006, 12:38:45 PM2/19/06
to
Thanks, it looks like what I want. I will try to implement it.
I might even learn something...

Jacob Lyles

unread,
Feb 19, 2006, 6:25:02 PM2/19/06
to
Hey Mark,

Let me know if you get this working. I've been wanting to add a similar
feature to my site. My alternative (and non-javascript version) will be
an ugly multi-page form.

Peace,
Jacob

Manuel Lemos

unread,
Feb 20, 2006, 2:22:56 PM2/20/06
to
Hello,

on 02/18/2006 05:48 PM Mark Winter said the following:

Take a look at this forms generation and validation class. It comes with
linked select plug-in class that does exactly what you want.

It lets you define select inputs with multiple groups of options that
are switched dynamically when the value of another input changes.

There is a static version of the plug-in that lets you define the
alternative groups as an array, and there are several variants of the
plug-in that picks the groups options from a database using different
API: MySQL or database independent with Metabase or PEAR::MDB2 API.

http://www.phpclasses.org/formsgeneration

Here is an example page:

http://www.phpclasses.org/browse/view/html/file/9879/name/test_linked_select_page.html

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

Reply all
Reply to author
Forward
0 new messages