passing value from a select list

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cneeds
Forum Newbie
Posts: 24
Joined: Tue Sep 14, 2010 1:39 am

passing value from a select list

Post by cneeds »

Hi

I have this select list of my clients and I want to pass the value of any client clicked on in the list to another page. This is my code. What am I doing wrong?

Code: Select all

<td rowspan=22 valign=top><select name="client_select_list" size=36 onclick="location.href='BDCmaintAADclients.php?default_client_ID=client_select_list.value'")>
Thanks

Chris
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: passing value from a select list

Post by Jonah Bron »

Code: Select all

<td rowspan=22 valign=top>
    <select name="client_select_list" size="36" onchange="location.href='BDCmaintAADclients.php?default_client_ID=' + this.value">
cneeds
Forum Newbie
Posts: 24
Joined: Tue Sep 14, 2010 1:39 am

Re: passing value from a select list

Post by cneeds »

Hi Jonah

Thanks. I got this to work

Code: Select all

+this.options[this.selectedIndex].value
but yours is much neater.

I'm using onclick because I populate a form with clients data so that user can see/amend it.

The form that I want to populate with the clicked client's data is on the same page as the list (BDCmaintAADclients.php). How can I populate it without having to reload the page? Something about the <DIV> tag and and href blah blah internal?

Thank you again for your help.

Chris
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: passing value from a select list

Post by Jonah Bron »

Yes. Google "ajax tutorial". Use AJAX to get the data from PHP, and then populate the field.
Post Reply