![]() |
![]() |
||||||
|
|||||||
| Tags: insert, redirect |
![]() |
|
|||
|
I am having an annoying problem with a simple admin back-end app. I have a form
to insert a record and then it is supposed to redirect to the main page or to the details page after insert. BUT, no matter what I try I cannot get it to work. Never had an issue with this before. I have tried the standard server behavior that comes with DW as well as the DataAssist behavior but neither will work. Any ideas or has anyone had this problem? It is quite frustrating. Dave |
| Sponsored Links |
|
|||
|
Seems to have something to do with the header(sprintf("Location: %s",
$deleteGoTo)); code. Get the following php errors. [30-Aug-2008 20:51:07] PHP Warning: Cannot modify header information - headers already sent in /usr/web/home/fsmgroup.zuka.net/docs/site/admin/de lete.php on line 44 [30-Aug-2008 20:51:20] PHP Warning: Cannot modify header information - headers already sent in /usr/web/home/fsmgroup.zuka.net/docs/site/admin/de lete.php on line 44 Thanks for any help. Dave |
|
|||
|
> [30-Aug-2008 20:51:07] PHP Warning: Cannot modify header information -
> headers already sent in > /usr/web/home/fsmgroup.zuka.net/docs/site/admin/de lete.php on line 44 > [30-Aug-2008 20:51:20] PHP Warning: Cannot modify header information - > headers already sent in > /usr/web/home/fsmgroup.zuka.net/docs/site/admin/de lete.php on line 44 This is a common error. It means that you have already 'written' something to the page prior to the redirect command. The place where you have done this is exactly specified in the error message - line 44. What do you have on that line? -- Murray --- ICQ 71997575 Adobe Community Expert (If you *MUST* email me, don't LAUGH when you do so!) ================== http://www.projectseven.com/go - DW FAQs, Tutorials & Resources http://www.dwfaq.com - DW FAQs, Tutorials & Resources ================== "dfilchak" <webforumsuser@macromedia.com> wrote in message news:g9cq4e$m4$1@forums.macromedia.com... > Seems to have something to do with the header(sprintf("Location: %s", > $deleteGoTo)); code. Get the following php errors. > > [30-Aug-2008 20:51:07] PHP Warning: Cannot modify header information - > headers already sent in > /usr/web/home/fsmgroup.zuka.net/docs/site/admin/de lete.php on line 44 > [30-Aug-2008 20:51:20] PHP Warning: Cannot modify header information - > headers already sent in > /usr/web/home/fsmgroup.zuka.net/docs/site/admin/de lete.php on line 44 > > Thanks for any help. > > Dave > |
|
|||
|
On that line is the header redirect. Here is the code leading up to the
redirect: <?php virtual('/Connections/conAdmin.php'); ?><?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } if ((isset($_POST['usr_id'])) && ($_POST['usr_id'] != "")) { $deleteSQL = sprintf("DELETE FROM fsm_users WHERE usr_id=%s", GetSQLValueString($_POST['usr_id'], "int")); mysql_select_db($database_conAdmin, $conAdmin); $Result1 = mysql_query($deleteSQL, $conAdmin) or die(mysql_error()); $deleteGoTo = "/site/admin/users.php"; if (isset($_SERVER['QUERY_STRING'])) { $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?"; $deleteGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $deleteGoTo)); } Dave |
|
|||
|
If there are any blank lines or whitespace between PHP tags, then you will
get errors like this, but from the error message you have shown, and the code block you show, I do not see any candidates for this. Did you solve it? -- Murray --- ICQ 71997575 Adobe Community Expert (If you *MUST* email me, don't LAUGH when you do so!) ================== http://www.projectseven.com/go - DW FAQs, Tutorials & Resources http://www.dwfaq.com - DW FAQs, Tutorials & Resources ================== "dfilchak" <webforumsuser@macromedia.com> wrote in message news:g9ee8v$mfd$1@forums.macromedia.com... > On that line is the header redirect. Here is the code leading up to the > redirect: > > <?php virtual('/Connections/conAdmin.php'); ?><?php > if (!function_exists("GetSQLValueString")) { > function GetSQLValueString($theValue, $theType, $theDefinedValue = "", > $theNotDefinedValue = "") > { > $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : > $theValue; > > $theValue = function_exists("mysql_real_escape_string") ? > mysql_real_escape_string($theValue) : mysql_escape_string($theValue); > > switch ($theType) { > case "text": > $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; > break; > case "long": > case "int": > $theValue = ($theValue != "") ? intval($theValue) : "NULL"; > break; > case "double": > $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : > "NULL"; > break; > case "date": > $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; > break; > case "defined": > $theValue = ($theValue != "") ? $theDefinedValue : > $theNotDefinedValue; > break; > } > return $theValue; > } > } > > if ((isset($_POST['usr_id'])) && ($_POST['usr_id'] != "")) { > $deleteSQL = sprintf("DELETE FROM fsm_users WHERE usr_id=%s", > GetSQLValueString($_POST['usr_id'], "int")); > > mysql_select_db($database_conAdmin, $conAdmin); > $Result1 = mysql_query($deleteSQL, $conAdmin) or die(mysql_error()); > > $deleteGoTo = "/site/admin/users.php"; > if (isset($_SERVER['QUERY_STRING'])) { > $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?"; > $deleteGoTo .= $_SERVER['QUERY_STRING']; > } > header(sprintf("Location: %s", $deleteGoTo)); > } > > > Dave > |
|
|||
|
Murray *ACE* wrote:
> If there are any blank lines or whitespace between PHP tags, then you > will get errors like this, The other thing that causes this error is selecting "Include Unicode Signature (BOM)" in New Document or Page Properties. -- David Powers, Adobe Community Expert Author, "The Essential Guide to Dreamweaver CS3" (friends of ED) Author, "PHP Solutions" (friends of ED) http://foundationphp.com/ |
|
|||
|
Perhaps that's it, then, because I could see nothing else in the quoted
material that was suspect. -- Murray --- ICQ 71997575 Adobe Community Expert (If you *MUST* email me, don't LAUGH when you do so!) ================== http://www.projectseven.com/go - DW FAQs, Tutorials & Resources http://www.dwfaq.com - DW FAQs, Tutorials & Resources ================== "David Powers" <david@example.com> wrote in message news:g9h2dq$iib$2@forums.macromedia.com... > Murray *ACE* wrote: >> If there are any blank lines or whitespace between PHP tags, then you >> will get errors like this, > > The other thing that causes this error is selecting "Include Unicode > Signature (BOM)" in New Document or Page Properties. > > -- > David Powers, Adobe Community Expert > Author, "The Essential Guide to Dreamweaver CS3" (friends of ED) > Author, "PHP Solutions" (friends of ED) > http://foundationphp.com/ |
|
|||
|
I have not solved it yet. It is driving me nuts and has stopped development of
this project dead in it's tracks. I have done this many times before with no issue and now I feel like I am looking for a needle in a haystack. I have even checked if php safe mode was set to on, which it isn't. I have tried setting the character encoding to ASCII, no help. I have searched high and low for whitespace and carriage returns that should not be there ... no go. I am in desparate need of help here but I do not know what to look for now. The other thing, is that it is not just this page. It is on any page where I do a redirect ... like on an insert to the dB page or a delete record page. Hard to finish an app when this is happening. Help!!! Dave |
|
|||
|
dfilchak posted in macromedia.dreamweaver.appdev:
(from earlier in thread): > <?php virtual('/Connections/conAdmin.php'); ?><?php Just a shot in the dark here, but did you double check for a carriage return after the ?> in Connections/conAdmin.php? Any difference if you include() or require() that file rather than virtual()? Not related, I'm sure, but why the closing PHP tag followed immediately by the opening PHP tag? Why not <?php virtual('/Connections/conAdmin.php'); -- Mark A. Boyd Keep-On-Learnin' ![]() |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
- Contact Us
-|-
Adobe Dreamweaver Forums -|-
Archive -|-
Top -|-Rules/Disclaimer-|-Help/Support-|-Advertise