Solved

After Insert Goto Problem

Posted on 2006-06-17
2
373 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
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…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

759 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now