# Getting form output from contents, not value

**URL:** <https://forum.kirupa.com/t/getting-form-output-from-contents-not-value/259483>\
**Category:** web dev\
**Created:** [May 6, 2008, 12:22am UTC](https://forum.kirupa.com/t/getting-form-output-from-contents-not-value/259483 "2008-05-06T00:22:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zoeman](https://avatars.discourse-cdn.com/v4/letter/z/47e85d/32.png) [@Zoeman](https://forum.kirupa.com/u/Zoeman)\
**Post date:** [May 6, 2008, 12:22am UTC](https://forum.kirupa.com/t/getting-form-output-from-contents-not-value/259483/1 "2008-05-06T00:22:40Z")

</div>

Hi all,

Just a quick question (I hope). I have a form with with lots of drop-down menus containing long, horrible medication names, which are outputted to a page for the user to print. I’ve been asked if I can make images of the selected drug appear on the outputted page, but I’ve hit a snag as to the best way to do it.

At the moment, a typical option looks like:

```auto
<option value="Seretide 50/25mcg puffer">Seretide 50/25mcg puffer</option>

```

And I access it using:

```auto
document.form.foo.value

```

My thought was to use the value to construct the image name, like so:

```auto
"<img src='images/" + document.form.foo.value + ".jpg'>"

```

Which is all fine and dandy, except a filename like ‘Seretide 50/25mcg puffer.jpg’ isn’t exactly ideal.

If I were to stick to that method of constructing the image names using simplified values, how might I output the full drug name? What do I use instead of value? Or, what would be a better way to generate the image names?

Thanks in advance!
