PDA

View Full Version : PHP URL Parameter needs to be cleared


Rayza
12-08-2011, 07:54 PM
I'm using DW-CS5 with PHP and MySQL.

I've created a page for company details which has 3 record sets: 1 for Company details, one for branch details related to the company and one for contacts related to the company. They all list properly as required. When i want to edit a branch i pass a URL Parameter with the branchID so that the recordset can pull the correct branch details on the branch edit page, which it does. When i submit the new data to the DB, i want it to go back to the previous page (company details) but pass a companyID as a URL parameter. I can set this up in DW, however PHP seems to be remembering the original URL Parameter of the branchID 'cos when i view the URL for the company details after the update i get this:

compdet.php?compID=&branchID=6 instead of
compdet.php?compID=4

The branchID was passed to get to the branch edit page and is not required when returning to the company details page. Why is it still in the URL?

edbr
12-08-2011, 11:50 PM
how does it go back to the page? As a redirect location: ?

Rayza
12-09-2011, 03:46 AM
When i generate the code for the form submission, i use the "update record" wizard which asks what page to load on submission. That's where i use the wizard to generate the compID:

compdet.php?compID=<?php echo $row_rsBranch['compID']; ?>

This is the code that is generated:

$updateGoTo = "compdet.php?compID=" . $row_rsBranch['compID'] . "";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];

One way i was thinking of getting around this was to pass a compID as well as a branchID to get to the branch edit page. Then when it goes back to the company details page it will just pass that same compID?