Jump to content

why cant I echo line after "header()" redirect...


mac007

Recommended Posts

Hello, all:

 

I am updating a simple table, and after the UPDATE statement gets processed, I want the page to refresh so the fields in the update form get new entries pulled right back. It works all fine, except I cant get the "Record Updated" lconfirmation line to echo also so user knows the update went fine. If I comment-out the "header()" then it echoes fine, but then form values dont refresh...

 

Appreciate the help!

 

This is code I have:

 

 

<CODE>

 

if (isset($_POST['notepadUpdateNOW']))

{

$subject = $_POST['subject'];

$note = $_POST['note'];

$notedate = $_POST['notedate'];

$noteUpdate = mysql_query("UPDATE NOTEPAD SET subject='$subject', note='$note', notedate = $notedate WHERE noteid = $noteRecord") or die('No records updated!');

header("location: #");

echo "Record Updated!";

}

 

</CODE>

 

As soon as your browser receives a header() redirect, it stops rendering the current page and requests the URL in the redirect. Any content you output on a page after a header redirect is just wasting your bandwidth.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.