Page 1 of 1

passing value from a select list

Posted: Tue Sep 21, 2010 3:43 pm
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

Re: passing value from a select list

Posted: Tue Sep 21, 2010 4:31 pm
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">

Re: passing value from a select list

Posted: Tue Sep 21, 2010 5:47 pm
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

Re: passing value from a select list

Posted: Tue Sep 21, 2010 7:53 pm
by Jonah Bron
Yes. Google "ajax tutorial". Use AJAX to get the data from PHP, and then populate the field.