Adobe Dreamweaver Forums



Last 10 THreads :         Opening different Flash Galleries with differentlinks... (Last Post : Nancy O - Replies : 8 - Views : 9 )           »          Favicon for context-sensitive Help (WebHelp) (Last Post : LuckyClover - Replies : 5 - Views : 6 )           »          Re: Help authenticating installer (Last Post : scarletnew - Replies : 2 - Views : 5 )           »          unlinking shared assets (Last Post : dmodie - Replies : 0 - Views : 1 )           »          Spry Accordion Panel Default State All Closed? (Last Post : Steven_K - Replies : 2 - Views : 3 )           »          Re: export image in D11 (Last Post : Applied CD - Replies : 0 - Views : 1 )           »          Re: Adobe Capture?? (Last Post : CatBandit - Replies : 0 - Views : 1 )           »          catching errors from remotely invoked processes (Last Post : Cr99 - Replies : 2 - Views : 3 )           »          Tabbing in flash created code (Last Post : PaulGene - Replies : 3 - Views : 4 )           »          Special Message Board creation (Last Post : NedWebs - Replies : 3 - Views : 4 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Dreamweaver: Main > Dreamweaver Application Development
 
Tags: ,



Reply
  #1 (permalink)  
Old 08-31-2008, 02:17 AM
dfilchak
 
Posts: n/a
Diggs:
Default redirect after insert

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



Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-31-2008, 02:17 AM
dfilchak
 
Posts: n/a
Diggs:
Default Re: redirect after insert

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

Reply With Quote
  #3 (permalink)  
Old 08-31-2008, 02:20 PM
Murray *ACE*
 
Posts: n/a
Diggs:
Default Re: redirect after insert

> [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
>


Reply With Quote


  #4 (permalink)  
Old 08-31-2008, 05:25 PM
dfilchak
 
Posts: n/a
Diggs:
Default Re: redirect after insert

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

Reply With Quote
  #5 (permalink)  
Old 09-01-2008, 03:13 PM
Murray *ACE*
 
Posts: n/a
Diggs:
Default Re: redirect after insert

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
>


Reply With Quote
  #6 (permalink)  
Old 09-01-2008, 04:43 PM
David Powers
 
Posts: n/a
Diggs:
Default Re: redirect after insert

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/
Reply With Quote


  #7 (permalink)  
Old 09-01-2008, 04:57 PM
Murray *ACE*
 
Posts: n/a
Diggs:
Default Re: redirect after insert

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/


Reply With Quote
  #8 (permalink)  
Old 09-01-2008, 05:30 PM
dfilchak
 
Posts: n/a
Diggs:
Default Re: redirect after insert

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

Reply With Quote
  #9 (permalink)  
Old 09-01-2008, 05:30 PM
dfilchak
 
Posts: n/a
Diggs:
Default Re: redirect after insert

I was hoping you were on to something with this but thhat preference is not
checked so I do not believe this is the culprit. I assume that if this wwas
checked, there would be something in the <head> section?

D

Reply With Quote


  #10 (permalink)  
Old 09-01-2008, 06:44 PM
Mark A. Boyd
 
Posts: n/a
Diggs:
Default Re: redirect after insert

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'
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 06:21 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Inactive Reminders By Mished.co.uk