ironman32 Posted April 8, 2009 Share Posted April 8, 2009 What I'm trying to do is show an error message if a field is empty. Here is my code <?php $age = $_POST['age']; $weight = $_POST['weight']; $medical = $_POST['medical']; if (empty ($_POST['age']) ){ header("Location: lose.php?msg=Invalid Login"); } ?> I'm currently getting this error message Warning: Cannot modify header information - headers already sent by (output started at /home/dontwork/public_html/workout3/lose2.php:2) in /home/dontwork/public_html/workout3/lose2.php on line 9 If anyone can help I would appreciate it. Link to comment https://forums.phpfreaks.com/topic/153198-solved-cannot-show-error-message/ Share on other sites More sharing options...
wildteen88 Posted April 8, 2009 Share Posted April 8, 2009 The error is caused be cause on line 2 in lose2.php you have some form of output. Make sure you don't have anything before your opening php tag (<?php) Link to comment https://forums.phpfreaks.com/topic/153198-solved-cannot-show-error-message/#findComment-804761 Share on other sites More sharing options...
schilly Posted April 8, 2009 Share Posted April 8, 2009 clear any space at the end of the php tag as well (after ?> at the end of the file) Link to comment https://forums.phpfreaks.com/topic/153198-solved-cannot-show-error-message/#findComment-804773 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.