Greetings,
I have a form that uses a child popup form to generate data for some fields on the form. The same popup is used for several fields. The forms use php & javascript.
An example of the field to be filled and the button that activates the popup is as follows:
<input type="text" size="60" name="cover" value="<?echo $cover;?>">
<input style="font-size:12px;color:#000066;font-family:verdana;" type="button" name="B1" value="..." onClick="popup('/test/test.php?field=cover','filechooser','640','480','center','front');">
The name of the field that needs to be filled is passed to the child popup via GET.
The popup asks for user input then generates a value for the "folder" field in the same form. Once the user is satisfied they click the OK button, the popup closes and the little bit of javascript passes the value of the "folder" field back to the appropriate field on the parent form.
$field=$_GET['field'];
<form>
<input type="text" size="60" name="folder" value="<echo $final_input;?>">
<input type="button" value="OK" onclick="window.close()">
<script language="javascript">
var myVar = "<echo $final_input;?>";
window.opener.input.<?echo $field;?>.value = myVar;
</script>
</form>
Now, all this actually mostly works quite well... Mostly... The problems occur when the field to be filled is an element of any array. ie
<input type="text" size="60" name="cover[0]" value="<?echo $cover[0];?>">
<input style="font-size:12px;color:#000066;font-family:verdana;" type="button" name="B1" value="..." onClick="popup('/test/test.php?field=cover[0]','filechooser','640','480','center','front');">
The popup loads, but I get the "done with errors" thingy. All the pocessing in the popup goes OK, but the value is not passed back to the parent form.
Any ideas what might be causing this or how to get around it? Or perhaps a better way of doing this?
Any help appreciated.
Thanks
Phil