Re: Can't relocate to a specified URL after submit.

From: Date: Fri, 14 Mar 2003 09:10:43 +0000
Subject: Re: Can't relocate to a specified URL after submit.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-139683@lists.php.net to get a copy of this message
Niklas Lampén wrote:
You cannot output anything before headers. Niklas -----Original Message----- From: Larry_Li@amat.com [mailto:Larry_Li@amat.com] Sent: 14. maaliskuuta 2003 8:03 To: php-general@lists.php.net Subject: [PHP] Can't relocate to a specified URL after submit. The code looks like: if( $actionflag == "delete" ) {
     //Delete Table ip_enrollment
     $query="delete from ip_enrollment where id='$id'";
     $AMC_DB->query("$query") or die("database server wasn't available
now.");
     //Delete Table ip_evaluation
     $query="delete from ip_evaluation where enrollmentID='$id'";
     $AMC_DB->query("$query") or die("database server wasn't available
now.");
     header( "ip-list.php?subMenuSelect=m1");
} It works fine before, but it seems header() doesn't work after I added some js code for preventing click submit twice.
I think I would try to get out of this problem by getting the form to submit to a new page unconditionally. Post the value of $actionflag to the new page. On the new page either show either the page for "delete ip_enrolment" or "ip-list.php...." depending upon the value of $actionflag. HTH Chris

« previous php.general (#139683) next »