Populate table at selection

Populate table at selection

am 22.04.2008 03:32:04 von freelance71

I have a combo box (select) and when the user selects a value I want to
populate an HTML table from DB depending on the value selected. Whats the
easiest way to achieve it. I've searched google and the examples require
java script. Is there a way to do this with only PHP. I had the impression
you could do anything with PHP. Infact there is a book titled 'How to do
every thing in PHP'!
--
When you argue with a fool, chances are he's doing the same

Re: Populate table at selection

am 22.04.2008 03:44:30 von Jerry Stuckle

freelance71 wrote:
> I have a combo box (select) and when the user selects a value I want to
> populate an HTML table from DB depending on the value selected. Whats the
> easiest way to achieve it. I've searched google and the examples require
> java script. Is there a way to do this with only PHP. I had the impression
> you could do anything with PHP. Infact there is a book titled 'How to do
> every thing in PHP'!
> --
> When you argue with a fool, chances are he's doing the same
>
>
>

PHP is server side. A select box is client side. You need a client
side routine - i.e. javascript.

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

Re: Populate table at selection

am 22.04.2008 08:08:06 von freelance71

"Jerry Stuckle" wrote in message
news:m5-dnZd-7K7Q35DVnZ2dnUVZ_uqdnZ2d@comcast.com...
> freelance71 wrote:
>> I have a combo box (select) and when the user selects a value I want to
>> populate an HTML table from DB depending on the value selected. Whats the
>> easiest way to achieve it. I've searched google and the examples require
>> java script. Is there a way to do this with only PHP. I had the
>> impression you could do anything with PHP. Infact there is a book titled
>> 'How to do every thing in PHP'!
>> --
>> When you argue with a fool, chances are he's doing the same
>
> PHP is server side. A select box is client side. You need a client side
> routine - i.e. javascript.
>
> --

Thanks.
Can a PHP script access/get the default value of a Combo box when the page
loads?

Re: Populate table at selection

am 22.04.2008 10:04:31 von Jeff North

On Tue, 22 Apr 2008 11:08:06 +0500, in comp.lang.php "freelance71"

wrote:

>|
>| "Jerry Stuckle" wrote in message
>| news:m5-dnZd-7K7Q35DVnZ2dnUVZ_uqdnZ2d@comcast.com...
>| > freelance71 wrote:
>| >> I have a combo box (select) and when the user selects a value I want to
>| >> populate an HTML table from DB depending on the value selected. Whats the
>| >> easiest way to achieve it. I've searched google and the examples require
>| >> java script. Is there a way to do this with only PHP. I had the
>| >> impression you could do anything with PHP. Infact there is a book titled
>| >> 'How to do every thing in PHP'!
>| >> --
>| >> When you argue with a fool, chances are he's doing the same
>| >
>| > PHP is server side. A select box is client side. You need a client side
>| > routine - i.e. javascript.
>| >
>| > --
>|
>| Thanks.
>| Can a PHP script access/get the default value of a Combo box when the page
>| loads?

If the default value is obtained from a database and php sets the
value then yes.

If the default value is within the HTML page then you will need to
parse the page (within php) to get the value. This needs to be done
before the page is sent to the browser.

Why don't you want to use javascript as what you've described is an
ideal candidate for AJAX.
-- ------------------------------------------------------------ -
jnorthau@yourpantsyahoo.com.au : Remove your pants to reply
-- ------------------------------------------------------------ -

Re: Populate table at selection

am 22.04.2008 13:23:35 von Jerry Stuckle

freelance71 wrote:
> "Jerry Stuckle" wrote in message
> news:m5-dnZd-7K7Q35DVnZ2dnUVZ_uqdnZ2d@comcast.com...
>> freelance71 wrote:
>>> I have a combo box (select) and when the user selects a value I want to
>>> populate an HTML table from DB depending on the value selected. Whats the
>>> easiest way to achieve it. I've searched google and the examples require
>>> java script. Is there a way to do this with only PHP. I had the
>>> impression you could do anything with PHP. Infact there is a book titled
>>> 'How to do every thing in PHP'!
>>> --
>>> When you argue with a fool, chances are he's doing the same
>> PHP is server side. A select box is client side. You need a client side
>> routine - i.e. javascript.
>>
>> --
>
> Thanks.
> Can a PHP script access/get the default value of a Combo box when the page
> loads?
>
>
>

If PHP is setting the value in the combobox, yes.

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

Re: Populate table at selection

am 22.04.2008 19:11:31 von venti

On Apr 22, 7:23 am, Jerry Stuckle wrote:
> freelance71 wrote:
> > "Jerry Stuckle" wrote in message
> >news:m5-dnZd-7K7Q35DVnZ2dnUVZ_uqdnZ2d@comcast.com...
> >> freelance71 wrote:
> >>> I have a combo box (select) and when the user selects a value I want to
> >>> populate an HTML table from DB depending on the value selected. Whats the
> >>> easiest way to achieve it.

You can do it all with PHP if you'd like, although it might get
messy .
You've got 3 ways to go:
1) The Wrong Way.
Bake everything into the file using php. This means creating the
select form with php, and also dynamically creating javascript with
php. Because you already know the only possibly options the user might
select, you just load the different table data though php/mysql and
shove them into javascript variables (within php. i.e. "