Alex LL
|
| Posted: 05/22/2002, 7:19 AM |
|
Hello,
I just added this code to After Insert Events in a Record Form.
print "Record Successfully Inserted!";
sleep(2);
and I get this, in a blank page:
Warning: Cannot add header information - headers already sent by (output started at /path_name/APFRec.php:235) in /path_name/APFRec.php on line 242
where APFRec.php is the Insert Page. Form Action for Record Form is to jump to another page.
My idea is to display a confirmation for the creation of a new record.
How should I do?
Thanks,
Alex LL
|
|
|
 |
Nicole
|
| Posted: 05/22/2002, 11:00 PM |
|
Alex,
when record form is submitted he is redirected to the same page (APFRec.php in your case) and action function is executed (sql query is built and executed). After that user is redirected to other page (that is specified as 'Form Action') using PHP function header(). If you refer to PHP docs you'll find that there's cannot be any output on the page before this function call, otherwise you get warning message mentioned above.
Here are couple workarounds:
- create additional confirmation page. While record is successfully inserted (updated or deleted) store any value in custom session variable. Redirect user to confirmation page first and display confirmation message.
- store confirmation message in e.g. session variable and in Page Open event of next page use JavaScript to pop up window with confirmation message.
E.g.:
if (get_session("var_name") != "")
echo "<script language = 'javascript'> alert('" . get_session("var_name") . "') </script>";
|
|
|
 |
|