0
Insert Recordset - Redirect Url not working - PHP
New Here
,
/t5/dreamweaver-discussions/insert-recordset-redirect-url-not-working-php/td-p/258836
Aug 20, 2007
Aug 20, 2007
Copy link to clipboard
Copied
I'm trying to insert a record then jump to a confirmation
page, but I can't seem to get it to work. The record is inserted
but the page doesn't redirect. I get no error message. Here's the
PHP code:
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "addform")) {
$insertSQL = sprintf("INSERT INTO bios (bio_personname, bio_persontitle) VALUES (%s, %s)",
GetSQLValueString($_POST['bio_personname'], "text"),
GetSQLValueString($_POST['bio_persontitle'], "text"));
mysql_select_db($database_connCasey_fcs, $connCasey_fcs);
$Result1 = mysql_query($insertSQL, $connCasey_fcs) or die(mysql_error());
$insertGoTo = "/faculty/bios/confirm_test.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "addform")) {
$insertSQL = sprintf("INSERT INTO bios (bio_personname, bio_persontitle) VALUES (%s, %s)",
GetSQLValueString($_POST['bio_personname'], "text"),
GetSQLValueString($_POST['bio_persontitle'], "text"));
mysql_select_db($database_connCasey_fcs, $connCasey_fcs);
$Result1 = mysql_query($insertSQL, $connCasey_fcs) or die(mysql_error());
$insertGoTo = "/faculty/bios/confirm_test.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
TOPICS
Server side applications
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/dreamweaver-discussions/insert-recordset-redirect-url-not-working-php/m-p/258837#M97693
Aug 20, 2007
Aug 20, 2007
Copy link to clipboard
Copied
casey_g wrote:
> $insertGoTo = "/faculty/bios/confirm_test.php";
This should be a fully qualified URL, complete with http:// and the
domain name.
--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
> $insertGoTo = "/faculty/bios/confirm_test.php";
This should be a fully qualified URL, complete with http:// and the
domain name.
--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
casey_g
AUTHOR
New Here
,
/t5/dreamweaver-discussions/insert-recordset-redirect-url-not-working-php/m-p/258838#M97694
Aug 21, 2007
Aug 21, 2007
Copy link to clipboard
Copied
Thank you, David, for the quick reply. Unfortunately, the
insert record page still doesn't jump to the confirmation page,
even with the full URL.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/dreamweaver-discussions/insert-recordset-redirect-url-not-working-php/m-p/258839#M97695
Aug 21, 2007
Aug 21, 2007
Copy link to clipboard
Copied
casey_g wrote:
> Thank you, David, for the quick reply. Unfortunately, the insert record page still doesn't jump to the confirmation page, even with the full URL.
At a guess, then, you probably have display_errors turned off, which is
preventing the display of a "headers already sent" error message. If
there is any output to the browser before header(), the page cannot be
redirected. This is caused by space in front of the opening PHP tag, or
new lines at the bottom of any include files, such as the Connection file.
--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
> Thank you, David, for the quick reply. Unfortunately, the insert record page still doesn't jump to the confirmation page, even with the full URL.
At a guess, then, you probably have display_errors turned off, which is
preventing the display of a "headers already sent" error message. If
there is any output to the browser before header(), the page cannot be
redirected. This is caused by space in front of the opening PHP tag, or
new lines at the bottom of any include files, such as the Connection file.
--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
casey_g
AUTHOR
New Here
,
/t5/dreamweaver-discussions/insert-recordset-redirect-url-not-working-php/m-p/258840#M97696
Aug 21, 2007
Aug 21, 2007
Copy link to clipboard
Copied
David,
Thanks again. This is the right track. When I copy the connection code directly into the insert record page, it does redirect correctly.
But I can't find any extra spaces or newlines in either the insert record page or the Connection script - is there anything else to look for?
Thanks again. This is the right track. When I copy the connection code directly into the insert record page, it does redirect correctly.
But I can't find any extra spaces or newlines in either the insert record page or the Connection script - is there anything else to look for?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/dreamweaver-discussions/insert-recordset-redirect-url-not-working-php/m-p/258841#M97697
Aug 21, 2007
Aug 21, 2007
Copy link to clipboard
Copied
casey_g wrote:
> Thanks again. This is the right track. When I copy the connection code
> directly into the insert record page, it does redirect correctly.
> But I can't find any extra spaces or newlines in either the insert record page
> or the Connection script - is there anything else to look for?
If it works when you copy the connection code into the insert record
page, there's only one answer: there is something in the connection
script that is causing it. Place your cursor immediately to the left of
the opening PHP tag in the connection script and press Backspace several
times. Click as far down on the page as you can after the closing PHP
tag, and press Backspace until your cursor is directly to the right of
the closing angle bracket.
The usual giveaway is that line numbering extends below the closing tag
of the connection file.
--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
> Thanks again. This is the right track. When I copy the connection code
> directly into the insert record page, it does redirect correctly.
> But I can't find any extra spaces or newlines in either the insert record page
> or the Connection script - is there anything else to look for?
If it works when you copy the connection code into the insert record
page, there's only one answer: there is something in the connection
script that is causing it. Place your cursor immediately to the left of
the opening PHP tag in the connection script and press Backspace several
times. Click as far down on the page as you can after the closing PHP
tag, and press Backspace until your cursor is directly to the right of
the closing angle bracket.
The usual giveaway is that line numbering extends below the closing tag
of the connection file.
--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
New Here
,
/t5/dreamweaver-discussions/insert-recordset-redirect-url-not-working-php/m-p/258842#M97698
Aug 29, 2007
Aug 29, 2007
Copy link to clipboard
Copied
If I can add to this discussion, I had the exact problem that
casey_g described. When I copied the configuration code into the
head of my insert page, things worked as expected. I also checked
my connection.php file and found no extraneous whitespaces.
It may have something to do with the format of the code that Dreamweaver enters into the page when using the Server Behaviors feature. Here is what is inserted at the beginning of my page:
It may have something to do with the format of the code that Dreamweaver enters into the page when using the Server Behaviors feature. Here is what is inserted at the beginning of my page:
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/dreamweaver-discussions/insert-recordset-redirect-url-not-working-php/m-p/258843#M97699
Aug 29, 2007
Aug 29, 2007
Copy link to clipboard
Copied
weidemannia wrote:
> Here is what is
> inserted at the beginning of my page:
>
> <?php virtual('Connections/gs37.php'); ?>
Dreamweaver uses virtual() if you choose in your site definition to make
links relative to the site root.
> However, I find that if I change it to read:
>
> <?php include('Connections/gs37.php') ?>
>
> It works properly. Is there a setting in Dreamweaver that I need to adjust so
> that it writes and include statement rather than virtual?
The virtual() function works only with PHP installed as an Apache
module. The include() command, however, works on any PHP system. If
virtual() doesn't work on your setup, you need to change your site
definition to use links relative to the document.
--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
> Here is what is
> inserted at the beginning of my page:
>
> <?php virtual('Connections/gs37.php'); ?>
Dreamweaver uses virtual() if you choose in your site definition to make
links relative to the site root.
> However, I find that if I change it to read:
>
> <?php include('Connections/gs37.php') ?>
>
> It works properly. Is there a setting in Dreamweaver that I need to adjust so
> that it writes and include statement rather than virtual?
The virtual() function works only with PHP installed as an Apache
module. The include() command, however, works on any PHP system. If
virtual() doesn't work on your setup, you need to change your site
definition to use links relative to the document.
--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
New Here
,
LATEST
/t5/dreamweaver-discussions/insert-recordset-redirect-url-not-working-php/m-p/258844#M97700
Aug 29, 2007
Aug 29, 2007
Copy link to clipboard
Copied
Thanks, David. Tremendous help!
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

