It looks OK as far as syntax. If you're not getting the desired result, then probably $_POST['action'] is not being set the way you think it should be, or there is a spelling mismatch (for instance, if the form element is named "Action" instead of "action"). You might want to debug by adding the following lines somewhere to see what values were actually passed to the script:
PHP Code:
echo "<pre>";
print_r($_POST);
echo "</pre>\n";
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
if (isset($_POST['action'])) {
if($_POST['action'] == 'whatever') {
header("register.php");
}
}
//Where "whatever" comes from the submit button (for example):
<input type="submit" name="action" value="whatever">
Also HTTP/1.1 requires an absolute URI as argument to Location: including the scheme, hostname and absolute path, but some clients accept relative URIs. I dunno if that's the issue here or not.
Bookmarks