derbystar16 Posted February 15, 2007 Share Posted February 15, 2007 I have a MySQL table with two columns: Name and Email What I need to do is in my PHP page, insert a dynamic list box populated with all of the names in the table. I have that working. Next, when I click on any of the names in that list box, I want the corresponding email address to show up in a seperate text field. This is something that shouldn't be difficult but I've been beating my head against the wall trying to figure it out. When a name is selected, the text field displays that person's corresponding email. Can anyone help me out? I'm using dreamweaver mx 2004 and a PHP page. Thanks. Link to comment https://forums.phpfreaks.com/topic/38671-dynamic-list-populating-text-field/ Share on other sites More sharing options...
corillo181 Posted February 15, 2007 Share Posted February 15, 2007 your question is not very clear, are you trying to email the name you click on? or why dont you just bring the email next to the name such as. | name | [email protected] | Link to comment https://forums.phpfreaks.com/topic/38671-dynamic-list-populating-text-field/#findComment-185720 Share on other sites More sharing options...
craygo Posted February 15, 2007 Share Posted February 15, 2007 You will not be able to do this with php. PHP is server side so you would have to select the name first, submit it, then php will output the e-mail address. The only way to do what you want would be to use ajax or javascript to have the e-mail address show when you click on a name. Ray Link to comment https://forums.phpfreaks.com/topic/38671-dynamic-list-populating-text-field/#findComment-185728 Share on other sites More sharing options...
corillo181 Posted February 15, 2007 Share Posted February 15, 2007 you can do it with css albo if you know how to use css very well. Link to comment https://forums.phpfreaks.com/topic/38671-dynamic-list-populating-text-field/#findComment-185729 Share on other sites More sharing options...
derbystar16 Posted February 15, 2007 Author Share Posted February 15, 2007 All im trying to do is when the person clicks on their name in the drop down menu, their corresponding email is displayed in a text box. This isn't possible in PHP? Link to comment https://forums.phpfreaks.com/topic/38671-dynamic-list-populating-text-field/#findComment-185734 Share on other sites More sharing options...
corillo181 Posted February 15, 2007 Share Posted February 15, 2007 i'm not getting you right but if you want it to happen with php, just give the email value in a php session and make a if statement that when the user click his name refresh the page and to show the email if(set()){ echo $email } Link to comment https://forums.phpfreaks.com/topic/38671-dynamic-list-populating-text-field/#findComment-185736 Share on other sites More sharing options...
derbystar16 Posted February 15, 2007 Author Share Posted February 15, 2007 corillo, thanks for trying to help but your last reply is very vague. I dont understand what you're saying. Can you elaborate some more? Link to comment https://forums.phpfreaks.com/topic/38671-dynamic-list-populating-text-field/#findComment-185761 Share on other sites More sharing options...
corillo181 Posted February 15, 2007 Share Posted February 15, 2007 are you working with sessions? Link to comment https://forums.phpfreaks.com/topic/38671-dynamic-list-populating-text-field/#findComment-185779 Share on other sites More sharing options...
derbystar16 Posted February 15, 2007 Author Share Posted February 15, 2007 no im not.... if im reading in a table dynamically containing two fields, name and email....how can i do this another way if php is not an option Link to comment https://forums.phpfreaks.com/topic/38671-dynamic-list-populating-text-field/#findComment-185782 Share on other sites More sharing options...
derbystar16 Posted February 17, 2007 Author Share Posted February 17, 2007 Nevermind... I taught myself and used AJAX... what a wonderful thing. Thanks to all that helped! Link to comment https://forums.phpfreaks.com/topic/38671-dynamic-list-populating-text-field/#findComment-186774 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.