tqla Posted July 3, 2007 Share Posted July 3, 2007 I know why Headers Already Sent errors occur and I have put my processing at the top of the page to avoid this. However, the processing includes echo messages that will show if certain fields are not filled in or incorrect like this: } else { echo "<font color=\"#FF0000\">The Promotional code that you have entered does not exists or has already been redeemed.</FONT><BR><BR>"; } The problem is these messages get echo'd at the top of the page and under a header graphic. Is there a way to take the echo message and move them lower on the page? Like maybe have the echo kick in an error message that's just above the form? Quote Link to comment Share on other sites More sharing options...
per1os Posted July 3, 2007 Share Posted July 3, 2007 Put the message into a string and echo that string where you want it. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted July 3, 2007 Share Posted July 3, 2007 So basically what your saying is that at the top of your script, you are checking for errors - which if there are any you want to echo the result. Further down, you also might redirect someone(presumably if there are no errors?) If so, i would store the error text in a variable, and perhaps set another variable, $errors for example to the value yes: else { $error_text .= "<font color=\"#FF0000\">The Promotional code that you have entered does not exists or has already been redeemed.</FONT><BR><BR>"; $errors = 'yes'; } Then, wherever you would want to show these errors, you would use: <?php if($errors =='yes'){ echo $error_text; } ?> Meh, beaten to it - ill post anyway since ive typed out the example. Quote Link to comment Share on other sites More sharing options...
tqla Posted July 3, 2007 Author Share Posted July 3, 2007 Right on! Works great! Thanks Frost110 and GingerRobot. Thanks for typing it out too GingerRobot. I probably would've been stuck there for awhile. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.