Php data display

Reply

Join Date: Feb 2008
Posts: 3
Reputation: Papa Awortwe is an unknown quantity at this point 
Solved Threads: 0
Papa Awortwe Papa Awortwe is offline Offline
Newbie Poster

Php data display

 
0
  #1
Jun 15th, 2008
Please I have a problem. I have a list of countries in my database. After someone completes filling a form which is then stored in the database, the value for a country appears in the database instead of the country name. For example ,when some selects England from a list ,Instead of the name England appearing in the database its value appears like 24. I used the drop down menu in doing this.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 848
Reputation: R0bb0b is on a distinguished road 
Solved Threads: 68
R0bb0b's Avatar
R0bb0b R0bb0b is offline Offline
Practically a Posting Shark

Re: Php data display

 
0
  #2
Jun 15th, 2008
It would help to have some sample code but I would assume that your dd list looks something like this

  1. <select name="selCountry">
  2. <option value="24">Country Name 1</option>
  3. <option value="25">Country Name 2</option>
  4. </select>

in this case in a post $_POST['selCountry'] would equal the selected "value" of the dd list and that is what would be posted to the database. If your database is set up in normal form this would be correct because that would then refer to the primary key of the countries table. If you want the actual country name stored in the inserted record then you will probably want to put the country name in the value attribute of the <option> tag.
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 252
Reputation: ProfessorPC is an unknown quantity at this point 
Solved Threads: 27
ProfessorPC ProfessorPC is offline Offline
Posting Whiz in Training

Re: Php data display

 
0
  #3
Jun 15th, 2008
or when you pull the info you could leave the country id and do a join in your query to pull the name from that id.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 585 | Replies: 2
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC