0

In a framework like Django or Pylons you can set up function to handle form submissions. If your form involves a dropdown menu (i.e. a select tag) populated with objects from a database you can set the values equal to the primary key for the record like:

<select>
  <option value="1">Volvo</option>
  <option value="2">Saab</option>
  <option value="3">Mercedes</option>
  <option value="4">Audi</option>
</select>

Is this a safe practice? Is there anything wrong with using a primary key? If you were not to use the primary key for the value how else can you make this form?

hekevintran
  • 22,822
  • 32
  • 111
  • 180

1 Answers1

3

Using the primary key is fine. What exactly are you concerned with? This is an implementation detail that won't show up to the user in the actual rendered page.

nosklo
  • 217,122
  • 57
  • 293
  • 297