0

Yesterday I setup a message/note script for a "view project" page. It seemed to work fine. Today I went to test it out a bit more and on random occasions I get stuck in a confirm loop.
Screenshot: http://rawrgv.com/images/screenlnl.png

I tried unsetting the form submit variable, but that doesn't seem to do anything.
Code:

<?
if(isset($_POST['newnote'])){
    $uid = $_POST['uid'];
    $oid = $_POST['oid'];
    $level = $_POST['level'];
    $note = $_POST['note'];
    $result = mysql_query("INSERT INTO notes (uid, oid, level, note) VALUES ('$uid', '$oid', '$level', '$note') ") or die(mysql_error());
    if($result){
        unset($_POST['newnote']);
        echo "<meta http-equiv=\"Refresh\" content=\"0;url=$HTTP_SERVER_VARS[PHP_SELF]?id={$orderID}\">";
    }
    else{
        echo "<BR /><BR />Submission Failed";
    }
}
else{
    $getComments = mysql_query("SELECT * FROM notes WHERE oid = '$oid' ORDER BY time");
    $comCount = 0;
    while($commentRow = mysql_fetch_assoc($getComments)){
        $level = $commentRow['level'];
        if($level == 1)
            $level = "<font color='black'>Appraiser</font>";
        else if($level == 2)
            $level = "<font color='blue'>Client</font>";
        else if($level == 3)
            $level = "<font color='red'>Admin</font>";
        else
            $level = "Unknown";
            
        $comCount++;
    ?>
        <p><? echo $level; echo ": "; echo $commentRow['note']; ?><BR />----------------------<BR /></p>
    <?
    } //end while
    
    /*if($comCount == 0){
    ?>
    <p><? echo "No Notes"; ?><BR /></p>
    <?
    } */ //end if
        
    ?>
    <form action="<? echo $HTTP_SERVER_VARS['PHP_SELF']; echo "?id={$orderID}"; ?>" method="post"> 
			<br />
            
			<div class="shadowDivider">&nbsp;</div>
                                
                        <div class="formRow">
                        <textarea name="note" cols="50" rows="5" onclick="this.value = '';">Enter your note here...
                        </textarea>
				<input type="hidden" name="uid" value="<? echo $userID; ?>" />
                                <input type="hidden" name="oid" value="<? echo $orderID; ?>" />
                                <input type="hidden" name="level" value="<? echo $userAccount; ?>" />
			</div><!--end formRow-->
                                
                                
			<div id="buttons">
				<input type="submit" value="Submit" class="button" name="newnote" />
				<? //<input type="button" value="County Serviced" class="button" /> ?>
			</div><!--end buttons-->
		</form>
                <BR /><BR /><BR /><BR /><BR />
    
    <? 
}
?>

Edited by Encrypted: n/a

2
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by Encrypted
0

Try replacing the meta on line 10 with the following:

header('Location: '.$HTTP_SERVER_VARS['PHP_SELF'].'?id='$orderID); exit();
0

You missed a .

But that returned

Warning: Cannot modify header information - headers already sent by (output started at /home/knex/public_html/includes/header.php:5) in /home/knex/public_html/cp/notes.php on line 9

I guess I could just throw this code in the header.. but.. that doesn't seem very practical.

Edited by Encrypted: n/a

0

That error means that you did some html or text output to the browser before the header function. So make sure there is no text output (eg echo function) before the header function.

0

That error means that you did some html or text output to the browser before the header function. So make sure there is no text output (eg echo function) before the header function.

Then this isn't going to help me at all because I'm running this in the middle of a page.

I'll try to run it in a separate page, but it's going to be a pain in the a-word.

Nevermind, I lied.. that was easy. Thanks.

Edited by Encrypted: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.