Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Join Date
    Apr 2007
    Thanked 5 Times in 5 Posts

    header already modified [resolved]

    Hy guys.
    I was writing simple comment script for a friend, and now i'm stuck with page refresh. This is the full script
    PHP Code:
    <!--Some random HTML code-->

    <?php echo file_get_contents("komentari.txt"); ?>

    <form action="" method="post">
        <li><input type="text" name="nadimak"></li>
        <li><textarea name="text"></textarea></li>
        <li><input type="submit" value="komentiraj"></li>
    if (isset($_POST['nadimak'])) {

        if (
    $_POST['nadimak'] == '' || $_POST['text'] == '') {
    "Ispunite oba polja";
        else {
    $nadimak htmlspecialchars($_POST['nadimak']);
    $text htmlspecialchars($_POST['text']);
    $tekst .= "<h3>".stripslashes($nadimak)." kaže:</h3>\n<p class=\"komentar\">".stripslashes($text)."</p>\n";
    upis ($tekst);

    upis ($tekst) {
    $file "komentari.txt";
    $file fopen ($file'a+');
    fputs ($file$tekst);
    fclose ($file);
    #where did i set those headers?!
    header("Location: index.php");

    Error code:

    Warning: Cannot modify header information - headers already sent by (output started at D:\xampp\htdocs\WORK\jasamza\index.php:6) in D:\xampp\htdocs\WORK\jasamza\index.php on line 70

    How can i refresh this page so that i get rid of POST variable?!

    Edit: Ok, another one i resolved right after posting. Just looked at the error, and figured out that if i put f-ion above the <doctype> headers will work, and that's true... mod's you can either delete or lock, or do nothing at all
    Last edited by matak; 11-04-2007 at 07:44 PM.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts