Hi All,
I have a form that submits to php_self.
at the beginning of the page, there is some code that should redirect to another page based on the button pressed:
<?php
//GET INITIAL VARIABLES
$image_id = (isset($_REQUEST['image_id'])) ? $_REQUEST['image_id'] : 0;
// REDIRECT if action is selected
$parameters = "?image_id={$image_id}";
if (isset($_POST['modify'])){
header ("Location: /actions/modify_image.php" . $parameters);
}
if (isset($_POST['delete'])){
header ("Location: /actions/modify_image.php" . $parameters);
}
if (isset($_POST['crop'])){
header ("Location: /actions/crop_image.php" . $parameters);
}
if (isset($_POST['insert'])){
header ("Location: /actions/insert_image.php" . $parameters);
}
?>
this is at the very beginning, so no header is already sent (and anyway i don't get the headers already sent error). But, whatever button i press, no redirection happens, and the same page is reloaded.
any explanations?
PHP manual says:
[INDENT]Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file. [/INDENT]
this could be my case, but i'm not clear how, since the page is just reloaded when the script is processed..
thanks,
Patrick