Solved

After Insert Goto Problem

Posted on 2006-06-17
2
377 Views
Last Modified: 2006-11-18
Hi all,
I have a page with an insert to DB setup and after inserting I want it to go to a different page. I've tried inserting this code to the end of the statement (as I checked what the dreamweaver wizard created when I tested it on a different page).

$insertGoTo = "thankyoufeedback.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));

But now when I try to click on a link to this page, it bypasses this page and takes me straight to the "thankyoufeedback.php page. How can I fix this?
Thanks,
D
0
Comment
Question by:dereksheahan
2 Comments
 
LVL 49

Accepted Solution

by:
Roonaan earned 450 total points
ID: 16926666
possibly use:

if($_SERVER['REQUEST_METHOD'] == 'POST') {
  $insertGoTo = "thankyoufeedback.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
  exit();
}

-r-
0
 

Author Comment

by:dereksheahan
ID: 16926670
Great! Thanks Roonaan
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question