Malcom,

Do your logic test before your input form. When you think of how a script is processed, on the server, then you'll see that the logic portion must precede any display portion.

Juli Meloni has a good example of this structure in her custom error message example. You'll find it at www.thickbook.com

Scripting often requires us to invert what we would see as the "normal" flow of eventsl

Cheers - Miles Thompson

At 09:01 AM 2/15/2003 -0500, Malcolm wrote:

Hello,

I've been fooling with this for a few days now.
I'm getting a hearders already sent error.
I know it means I've got output before the header but
I can't figure how else to do this.

The error messages;

(output started at c:\foxy\www\project_db\switchtest.php:2) in c:\foxy\www\project_db\switchtest.php on line 11

The script;


<?
echo "<h4> This script uses a predefined list of names to <i>switch</i></h4>";
echo"
Input mal, jim or joe <br>
<form> Your Name:
<input type = text name = dog>
<input type=submit name=blah value=Check Me Out !>
</form>";
switch ($dog) {
case mal:
header("location =../aamaillist/ml_menu.php");
break;
case jim:
echo "<body bgcolor=navy text=White>";
print "<Hi Jim<br>
If you were jim you could have a private page here.";
echo "</body>";
break;
case joe:
echo "<body bgcolor=gray text=#F8E714 >"; print "Hello Joe<br>";
echo "</body>";
break;
default:
print "You must be a stranger.<br>";
}
?>

How can I redirect without output before the header ?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to