Value of input box = value of checkbox

hi all

i have a checkbox and input box


<input  type="checkbox" value="<?php echo $others_text ?>" name="checkacc[]" id="checkacc[]"  /> 
Others <input  type="text" style="width:200px;" name="others_text"  />

i want that the customer should tick the checkbox and enter the information in text box and that information should become the value of checkbox.

what should i do.

i m not able to write value of checkbox.


can’t you jsut handle this in php? or is there some specific reason you want it in javascript?

That technique is guaranteed to fail when javascript isn’t enabled or available.

You will achieve success much faster and with greater accuracy by having the server-side code check if the checkbox is enabled, and if it is, then to read the textbox value.