Hi friend,

I want passing the selected text from list into text. i dont know how to do nu. I attached screenshot with this thread. if you can say to me.

Thanks......

Recommended Answers

All 7 Replies

<html>
<script lang='javascript'>
function onselectchange()
{
        document.formname.textboxname.value = document.formname.selelistname.options[document.formname.selelistname.selectedIndex].text;
}
</script>
<form name=formname>
<input type=textbox name=textboxname id=textboxname  >
<select name=selelistname onchange='javascript:onselectchange();'>
<option value='1'/>one
<option value='2'/>two
<option value='3'/>three
</select>
</form>
</html>

thanks............

i want to create cart system in php. it need maintain invoice number. customer select many items each time they click "add to cart". When they click "finish purchase" then only invoice number wil be increment. how to do this..

You might find this

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta name="generator" content=
    "HTML Tidy for Windows (vers 25 March 2009), see www.w3.org">
    <title></title>
  </head>
  <body>
    <form name='frm1' id="frm1">
      <input type="text" name="box1"> 
      <select id='sel1' onchange='document.frm1.box1.value=this[selectedIndex].text'>
        <option value='1'>
          one
        </option>
        <option value='2'>
          two
        </option>
        <option value='3'>
          three
        </option>
      </select>
    </form>
    <script type="text/javascript">
        var oTmp = document.getElementById('sel1')
        document.frm1.box1.value=oTmp[oTmp.selectedIndex].text
    </script>
  </body>
</html>

more useful. It sets the initial value (and the html passes validation).

Thanks...

i want to create cart system in php. it need maintain invoice number. customer select many items each time they click "add to cart". When they click "finish purchase" then only invoice number wil be increment. how to do this..

Try the PHP forum.

ya i try this. its working. i have one more doubt. values from list to text box successfully working. using this value can we retrieve data from database and displayed in another text box. u cant understand na i will send screen shot.

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.