Hi
I am using Inline Add to add a record to a slave table. There are good reasons for doing it this way rather than using a normal Add page.
I have the following code in the AfterAdd function of the Add Page
?><script>
window.open('4Letter_print.php?recordid=<?php echo $keys["id_det"]?>');
window.location.href='nd_pupils_list.php';
</script><?php
The window.open line of the script opens up a printer friendly page of a letter to go to the pupils parents, the second line of the script SHOULD redirect to the master table List page.
When I used the normal Add page, this worked.
When I save the record, either by clicking on the green tick of the inline Add or by clicking on the Save All button the following happens
The record is saved in the table but
Now I get a grey "Error Occurred" line under the first field. When I hover over it, i get a preview of the list page I should return to.
Is there something else I should be scripting the page to do as well?
When I disable the script, everything seems to work fine.
Just having the redirect to the pupils list page in the script and I get the error again, the record is saved and the preview shows the pupils_list page.
Just having the window.open for the printer page line in the script, the record is saved, the printer friendly page is opened, when closed it now shows the pupil's detentions record with all the detentions shown correctly.
So I have tried the script with just the window.open line in it and a separate redirect line as follows
header("Location:nd_pupils_list.php");
exit();
This produces a correct saved record, the printer friendly page but still the error occurred, but this time the preview from the error occurred shows the classic
Technical information Error Type 2, cannot modify header information.
If I recall correctly this error is the reason for the script I used from here in the first place.
I have looked in the help file for inline commands, but they do not seem to apply.
I would really like some help here, PHPR 4.2 build 379.
Cheers