Possible Duplicate:
Headers already sent by PHP
My MySQL database has two Tables: ‘Listing’
and ‘Country’
‘Country’
links to ‘Listing’ by ‘country_id’
The function createrow()
creates a new row in ‘Listing’
, this is done by 'Submit'
button using a Drop Down Selection Box, then the header command redirect to another page.
For some reason that I don’t know, if the Table ‘Country’
contains more than 35 records, I receive the following error message (p.s. under 35 records the header command redirect without errors):
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\MySQLprtnr\create.php:101) in C:\xampp\htdocs\MySQLprtnr\create.php on line 113
The code:
;
<input type="submit" name="Submit" value="Submit"></td>
</tr>
<?php
if (isset($_POST['Submit']))
{
$message = $_POST['message'];
$subject = $_POST['subject'];
$country_id = $_POST['country_id'];
createrow($message, $subject, $country_id);
header('Location: memberprofile.php');
}
?>
</form>
</table>
Line numbers:
Line #101: <?php
Line #113: 'header('Location: memberprofile.php');'
I have the following two questions:
- Why do I receive the above error message as explained?
- Since I don't have a solution for question #1, is there another way to redirect instead of 'header'` (maybe using Javascript)?
Thanks for any assistance,