I've never done things like this, so I may be missing some points in your method. I always structure the submit button with a "value=submit" and use "if (isset($_POST['submit']))" or "if (isset($_GET['submit']))" as my trigger. Sometimes I'll pass a variable "&sumitted=yes" with a hidden button.
First off, I don't understand how you're going to pass a value onto another page or even to your "if ($_GET)" conditional with (method="post") in your form. Aren't you looking for method="get"? Like I said, you might have an alternate technique I don't know -- if so, just ignore me

But apparently you are looking to pass a value 123** to the support_welcome page and it just isn't that hard.
Second, Geoff is certainly right - you can't just pass a header to the browser after you've passed anything else. One bit of whitespace passed to the browser and your header requires buffering. The first thing that happens on your page is that the user's brower receives
html.
But the whole point of the GET method is that you don't need a header to redirect the browser. Once the form is submitted with (action="another page") then
php will point to the code located on the action page and pass the GET variables to it, without need for a redirect. The redirection is already placed in the GET method.
Using a redirect header for the error page, with buffering, will work for the error portion. But it seems unnecessarily complex. My first instinct would be to do the form with a single submit and choose the action like this:
- Code: Select all
<form name="form" method="get" action="
<?php
if (substr($_GET['serial'], 0, 2) == "123") {
echo './../support_welcome.php';
}else{ echo 'error.php';}
?>
"><input . . .
I've never seen this but I'm pretty sure it would work. It should be all the code you need, other than boilerplate. You might want an "if" clause in the main
php section to trim any variables off the error URL. It might be more satisfactory to use a "die" statement in the conditional.