Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
06-28-2013, 10:42 PM #1
- Join Date
- Sep 2008
- Thanked 17 Times in 16 Posts
Get dropdown value when editing user
Hey guys, I am in need of some help, I have a table where it shows the people that have signed into a patient program.
Here is how it looks:
Right now if you look in the Location column, it says 8 instead of the last option in the dropdown being Manalapan.
Here is how the database table looks for offices location:
I would like to grab the office_name data from the database while retrieving the patient information in the table,from the table patients:
It is stored in the database as pat_loc and this one is 8.
In the end, I want it to say the name of the office, not the number it is stored at, first getting it from the patient table then going to the office table for the name.
Is there such a thing that can be done?
If needed, I will show my current code to see where it needs to be added.█ MY MSN: Sith717@Hotmail.com
█ PHP, HTML, and CSS Coding, Logo and Web Design - Professionally done.
█ PM me anytime for HTML, PHP or web design help. I will be glad to help you out.
06-29-2013, 06:59 AM #2
- Join Date
- Jun 2003
- Cottage Grove, Minnesota
- Thanked 1,084 Times in 1,075 Posts
What is the column type for pat_loc?
If it's integer, you'll have to change it ... as the text name is not an integer.
we'll have to see more code.
I suspect your dropdown location select shows the textual location, but the values are the office_id. Maybe changing the values of the dropdown options to the text name and making sure pat_loc column is perhaps VARCHAR(16) would be the only necessary changes?
06-29-2013, 10:08 AM #3
- Join Date
- Feb 2011
- Your Monitor
- Thanked 523 Times in 510 Posts
- Blog Entries
Easier fix, just join the two tables together and then you'll have the office_name set in each row matching what is set for the office_id:
select * from patients join pat_loc on pat_loc = office_id
Leave you layout as it is and just use a join. By doing what you're asking you'd be taking a step backwards. The way it's setup now makes it a lot easier - if you rename an office you only rename one record and all the others will use it with minimal hassle.
Last edited by tangoforce; 06-29-2013 at 10:19 AM.
See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/
Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!