943,864 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 650
  • PHP RSS
Jun 15th, 2008
0

Php data display

Expand Post »
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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Papa Awortwe is offline Offline
3 posts
since Feb 2008
Jun 15th, 2008
0

Re: Php data display

It would help to have some sample code but I would assume that your dd list looks something like this

PHP Syntax (Toggle Plain Text)
  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.
Reputation Points: 358
Solved Threads: 89
Posting Shark
R0bb0b is offline Offline
986 posts
since Jun 2008
Jun 15th, 2008
0

Re: Php data display

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.
Reputation Points: 31
Solved Threads: 29
Posting Whiz in Training
ProfessorPC is offline Offline
270 posts
since Dec 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: issue Posting emails while logging in dotproject with gmail account
Next Thread in PHP Forum Timeline: passing of values through image link





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC