I have a select menu with many text-based options. However when I submit the form, instead of actually returning the textual item in the POST variable is it possible to set it to return the ID of the selected item?

For example I have the following form:

<select name="dev_stage" id="dev_stage">
  <option>Initial Brief</option>
  <option>Initial Concept Design</option>
  <option>Design Development</option>
  <option>HTML Coding</option>
  <option>Server Side Coding</option>
  <option>SEO</option>
  <option>Feedback and Tweaking</option>
  <option>Delivery and Installation</option>
  <option>Invoiced</option>
</select>

If the user selected "Initial Brief" can I set the form to submit the ID '0' instead of "Initial Brief"?

Recommended Answers

All 2 Replies

An option value can be passed like this:

<option value = 1>Initial Brief</option>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.