| | |
Php data display
![]() |
•
•
Join Date: Feb 2008
Posts: 3
Reputation:
Solved Threads: 0
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.
It would help to have some sample code but I would assume that your dd list looks something like this
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.
PHP Syntax (Toggle Plain Text)
<select name="selCountry"> <option value="24">Country Name 1</option> <option value="25">Country Name 2</option> </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.
![]() |
Similar Threads
- php script for dropdown to fetch DB list and then Tables (PHP)
- Display php data in html div (PHP)
- Scrolling display is blurred (PHP)
- Storing dynamic form values in Arrays for display & insert (PHP)
- Filtering My sql through Php using drop down menu and text field (PHP)
- Hello Help I'm Wired PhP (PHP)
- new to php, need help adding a forum (PHP)
Other Threads in the PHP Forum
- Previous Thread: issue Posting emails while logging in dotproject with gmail account
- Next Thread: passing of values through image link
Views: 585 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for PHP
access ajax apache array arrays beginner binary box broken buttons cakephp check checkbox class cms code cookies database date delete directory display download dropdown drupal dynamic echo email error file files form forms function functions header href htaccess html image images include insert ip java javascript joomla jquery limit link list login loop mail menu mlm mod_rewrite multiple mysql order output parse password paypal php problem query radio regex remote results script search security select server session sessions soap sort sorting source sql string system table tutorial unicode update upload url user validation validator variable video web website wordpress xml





