Jump to content

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


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.

Thanks PFM, Maq...

 

So, one way I could I echo the line then, would be by storing a "success" or "failed" variable that then I can have it echo on redirected page??

But wouldnt that still be overtaken by the "header()" action??

 

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.