So I have a variable that I want to write as a form input value, if I use

Code:
<input name=fid_17 value=<script language="javascript">document.writeln(variable);</script>>
I get "scr" in the input box.

What is the correct way to write in the variable?