this may be a n00b question, but I recently started my own weblog and I'm having problems with the comment section. Basically, I want it so when a user posts a comment it checks the form, submits it, and then redirects the user to the actual comment page. I have everything working except it gives me this error when it tries to redirect:
Warning: Cannot modify header information - headers already sent by (output started at /home/content/j/p/i/jpitzo/html/php/comments/postcomm.php:11) in /home/content/j/p/i/jpitzo/html/php/comments/postcomm.php on line 36
Warning: Cannot modify header information - headers already sent by (output started at /home/content/j/p/i/jpitzo/html/php/comments/postcomm.php:11) in /home/content/j/p/i/jpitzo/html/php/comments/postcomm.php on line 36
Code:
<?php
// If form is filled out and submitted, POST form
if (isset($_POST['post'], $_POST['title'])) {
---DATABASE STUFF HERE---
header('Location: [url]http://www.joeyp.net/php/comments/compage.php?comname=[/url] ' . $comname );
}
else {
//If form isnt filled out, display form
echo "<form action='" . $postcomname . "' method='post'>
Title: <input type='text' name='title' /><br /><br />
Entry: <textarea name='post' rows='15' cols='20'>
</textarea><br />
Name: <input type='text' name='name' /><br /><br />
<input type='submit' />
</form>";
}
?>
other stuff here...