PHP warning

Hi!
I am sending some value through header like,

header(‘Location:quotation_details.php?query=edit’);

and I have error:

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\I\edit.php:7) in C:\xampp\htdocs\I\edit.php on line 39

This may be because I have used,

<form name=“form” method=“post” action=“<?php echo htmlentities($_SERVER[‘PHP_SELF’]); ?>” onSubmit=“return validateForm(this)”>

Can anyone please tell me how to resolve this problem??:frowning:

Because of,
You can make sure that, before calling the Header(), you cannot start output/displaying the content even <html> also…

Means,
header(‘Location:quotation_details.php?query=edit’);
After this statement only,
the output will start…

If you are outputting the form to the browser and then calling the header function, it will cause an error because you can’t have any output or whitespace before the header function. It might be possible to rewrite your code to fix this but if you can’t, then the other option is to use the HTML meta refresh tag to load the page instead of using header.

If it’s not possible to reorganise your code so that the header function appears before any output then another option is to echo out the javascript to use window.location.href=‘someURL’ to redirect to another page instead of header.

If you have to cater for the most likely relatively tiny number of javascript disabled browsers then the above option would not work in them.