Click to See Complete Forum and Search --> : contents of variable in form


MaxDax
12-04-2003, 05:26 AM
Hi

How do I get the contents of a variable into a hidden input field?

ie:
<input type="hidden" name="abc" value="xyz">

If I have a variable name foo with a value of 123. How do I get the contents of foo (123) into the hidden field named "abc"?

I have tried -
<input type="hidden" name="abc" value="<script type="text/javascript"> document.write("foo");</script>">
but that just writes the contents of foo to the screen.

Any clues would be most appreciated ...

Thanks
MaxDax

clairec666
12-04-2003, 05:29 AM
<script type="text/javascript">
var foo = 123;
document.write("<input type='hidden' name='abc' value='"+foo+"'>");
</script>

MaxDax
12-04-2003, 05:46 AM
Magic !!
Thank you kindly clairec666
much appreciated
MaxDax