Hi
I am working on a PHP-script and need javascript to set the value of a
hidden field in a form. This field happens to be an entry in an array
data[3] according to my example. How can I do this?
Below is listet two PHP-pages: one that doesn't work (to my dismay), and
another that does work, but do not use an array entry in the hidden field.
Thanks
Esben
---------- Doesn't work as planned -----------------
<? print "data[3]=".$data[3]."\n";?>
<form action='<?$PHP_ SELF?>' name='edit_form ' method=post
enctype='multip art/form-data'>
<input type=hidden name='data[3]' value='default :-('>
<script language='javas cript'>
document.edit_f orm.data[3].value = 'not default :-)';
</script>
<input type='submit'></form>
----------------------------------------------------------
----------Doesn't use arrays----------------------------
<? print "data3=".$data3 ."\n";?>
<form action='<?$PHP_ SELF?>' name='edit_form ' method=post
enctype='multip art/form-data'>
<input type=hidden name='data3' value='default :-('>
<script language='javas cript'>
document.edit_f orm.data3.value = 'not default :-)';
</script>
<input type='submit'></form>
----------------------------------------------------------
I am working on a PHP-script and need javascript to set the value of a
hidden field in a form. This field happens to be an entry in an array
data[3] according to my example. How can I do this?
Below is listet two PHP-pages: one that doesn't work (to my dismay), and
another that does work, but do not use an array entry in the hidden field.
Thanks
Esben
---------- Doesn't work as planned -----------------
<? print "data[3]=".$data[3]."\n";?>
<form action='<?$PHP_ SELF?>' name='edit_form ' method=post
enctype='multip art/form-data'>
<input type=hidden name='data[3]' value='default :-('>
<script language='javas cript'>
document.edit_f orm.data[3].value = 'not default :-)';
</script>
<input type='submit'></form>
----------------------------------------------------------
----------Doesn't use arrays----------------------------
<? print "data3=".$data3 ."\n";?>
<form action='<?$PHP_ SELF?>' name='edit_form ' method=post
enctype='multip art/form-data'>
<input type=hidden name='data3' value='default :-('>
<script language='javas cript'>
document.edit_f orm.data3.value = 'not default :-)';
</script>
<input type='submit'></form>
----------------------------------------------------------
Comment