I want to set an array as hidden and then use post method to pass the vaules in the array to the PHP. But it doesn’t work. My codes are:
[CODE]
<form name=”Service” onsubmit=”javascript:return validate_port()”
action=”submit.php?state=<?php echo($instance)?>§ion=Services” method=”post”>
<input type=”hidden” name=”service_hide[]” value=””>
<table width=”100%”>
<tr id=”service_button”>
<td align=”right”>
<input type=”button” value=”Add” class=”button1″ onclick=”addService()” >
</td>
<td align=”center”>
<input type=”submit” value=”Save” class=”button1″>
</td>
<td>
<input type=”submit” value=”Delete” class=”button1″ onclick=”setAction(this)”>
</td>
</tr>
</table>
</form>
The function of addService() is defined as follows:
[CODE]
function addService()
{
document.Service.service_hide[0].value = “0”;
}
When I press the “Add” button, nothing happens. It seems that there is a syntax error, but I don’t know where is the problem.
Can anyone please help me about that? Thanks in advance!
Rui