Solved

Strip off old header information

Posted on 2012-04-11
3
304 Views
Last Modified: 2012-06-22
I am working in php/mysql.  I am calling a page with some additional information in the header.  it looks something like this:

www.mysite.com/mypage.php?Series=CRY140-1

on this page I am doing an insert, and a redirect.

 $theRN = mysql_insert_id();
 $insertGoTo = "store.php?crn=0&rn=$theRN&action=show_detail";

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

The header is showing as
www.mysite.com/store.php?crn=0&rn=77857845&action=show_detail&Series=CRY140-1

It seems to have carried over the  "Series=CRY140-1".

It does it in ie and firefox.

How do I strip this off?
0
Comment
Question by:jws2bay
  • 2
3 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 37833817
Don't add it back.  This line:

$insertGoTo .= $_SERVER['QUERY_STRING'];

is adding the original query string back onto the URL you have created.  If you don't want it added back, you don't need that whole 'if' section.
0
 

Author Closing Comment

by:jws2bay
ID: 37834974
sometimes I just don't see the obvious.  Thanks
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 37835168
You're welcome, it happens to all of us.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Suggested Solutions

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

828 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