Whats rong?

Discussion in 'PHP' started by archgames.net, Feb 3, 2008.

  1. #1
    this is a comments form :

    <form name="form1" method="post" action="<? echo $site_url?>/index.php?id=<? echo $_GET[id];?>&task=add_comment">
      <p>
      <textarea name="comment" cols="50" rows="4" id="comment" class="TEXTAREA"></textarea>
      <br><input type="submit" name="Submit" value="Add Comment" class="btn" />
      </p>
    </form>
    
    PHP:
    and this is where it should do the action :
    <?php
    include ('secure.php');
    $comment = no_injection($_POST['comment']);
    $id = no_injection($_GET['id']);
    
    mysql_query("INSERT INTO ava_comments (user, comment, link_id) VALUES ('$userid', '$comment', '$id')");
    header("Location: $site_url/index.php?task=view&id=$_GET[id]");
    ?>
    PHP:
    but it shows this error when you visit the add_comment.php

    but it does add the comment but why does this message show up?

    please reply asap!
     
    archgames.net, Feb 3, 2008 IP
  2. SecureWebDev

    SecureWebDev Active Member

    Messages:
    677
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    80
    #2
    SecureWebDev, Feb 3, 2008 IP
  3. archgames.net

    archgames.net Well-Known Member

    Messages:
    532
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    120
    #3
    I dont understand =S Any help?
     
    archgames.net, Feb 3, 2008 IP
  4. archgames.net

    archgames.net Well-Known Member

    Messages:
    532
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    120
    #4
    any one?? =S
     
    archgames.net, Feb 3, 2008 IP
  5. kreoton

    kreoton Peon

    Messages:
    229
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #5
    there is an output before header function. You can not do any output before calling header function.
     
    kreoton, Feb 3, 2008 IP
  6. archgames.net

    archgames.net Well-Known Member

    Messages:
    532
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    120
    #6
    I tried to change that but it doesnt work... so i have to give a goback to play option !

    if you can help me it would be great !
     
    archgames.net, Feb 4, 2008 IP
  7. SoftCloud

    SoftCloud Well-Known Member

    Messages:
    1,060
    Likes Received:
    28
    Best Answers:
    2
    Trophy Points:
    120
    #7
    <?php
    ob_start();
    include ('secure.php');
    $comment = no_injection($_POST['comment']);
    $id = no_injection($_GET['id']);
    
    mysql_query("INSERT INTO ava_comments (user, comment, link_id) VALUES ('$userid', '$comment', '$id')");
    header("Location: $site_url/index.php?task=view&id=$_GET[id]");
    ob_flush();
    ?>
    PHP:
    Try that, hope it works. :D
     
    SoftCloud, Feb 4, 2008 IP
  8. archgames.net

    archgames.net Well-Known Member

    Messages:
    532
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    120
    #8
    nope it doesnt still have the probmlem...
     
    archgames.net, Feb 5, 2008 IP
  9. The Critic

    The Critic Peon

    Messages:
    392
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Try this:

    
    <?php
    include ('secure.php');
    $comment = no_injection($_POST['comment']);
    $id = no_injection($_GET['id']);
    mysql_query("INSERT INTO ava_comments (user, comment, link_id) VALUES ('$userid', '$comment', '$id')");
    echo "<meta http-equiv=\"refresh\" content=\"0; url=http://{$site_url}/index.php?task=view&id={$id}" \">";
    ?>
    
    PHP:
    It's a hack, but should work fine.
     
    The Critic, Feb 5, 2008 IP