Skip navigation
Currently Being Moderated

After Deleting, GoTo

May 17, 2012 2:20 PM

Tags: #cs5 #php #dreamweaver #mysql #delete_behavior #after_deleting_goto

I have a selection page showing filtered records from a table.  When I click Delete (column in display table), I go to a confirmation page.  When I click delete, the record is deleted, but instead of then going to the page specified, it displays the delete page again with the same parameters originally sent.  How can I get it to go back to the filtered display?  I have specified both the page AND add the parameter for the filter.  I've done and redone, but can't get back to the page.

 
Replies
  • Currently Being Moderated
    May 19, 2012 4:14 PM   in reply to ElizabethGailLittle

    What language?  Can you post the code you have that's not redirecting properly?

     
    |
    Mark as:
  • Currently Being Moderated
    May 23, 2012 6:57 PM   in reply to ElizabethGailLittle

    Sorry for the delay.  These problems are not as simple to solve as the "my page is out of alignment" posts so I want to make sure I'm reading everything right before answering.

     

    The problem in the code is here:

     

      $deleteGoTo = "TextPageDisplayAll.php?varpage=<?php echo $varpageSend ?>";

     

     

      if (isset($_SERVER['QUERY_STRING'])) {

        $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";

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

      }

     

     

      header(sprintf("Location: %s", $deleteGoTo));

    }

     

    First that varpage should not have the <?php echo statement in it because you are already in PHP, so the line should read:

     

    $deleteGoTo = "TextPageDispalyALl.php?varpage=".$varpageSend;

     

    Then if that is the address you want to send the user to, I'm trying to figure out why the "if --> isset" is being used to test for the Query String when it could just proceed to the "header" code as that uses the $deleteGoTo variable.  I don't think that isset rule is really necessary.

     
    |
    Mark as:
  • Currently Being Moderated
    May 25, 2012 6:07 AM   in reply to ElizabethGailLittle

    Not javascript, PHP.  The isset code is testing, if the Query_String, anything after the "?" in an adderess has a value, the $deleteGoTo variable then gets the original query string tagged onto the end.  It's an ugly way of adding any variables back to the URL.  In my personal opinion, that whole block could be done away with.

     

    Instead of deleting it, in case you want the old code or any reason, just comment out that block in PHP by putting a /* before the if statement and a */ after it, just before the header.

     

    If this is not producing the results you want I will need you to do the following.  Before the header statement insert the following code:

     

    echo "URL: ".$deleteGoTo; exit;

     

    ________________________________________________________

     

    Ok, here's an addition to what I was going to originally say.  Your action is set to nothing right now.  Is that the way it is on the page?  If so, you need to set the action to some page, even if it is the the page it needs to be entered in.

     
    |
    Mark as:
  •  
    |
    Mark as:
  • More Like This

    • Retrieving data ...

    Bookmarked By (0)

    Answers + Points = Status

    • 10 points awarded for Correct Answers
    • 5 points awarded for Helpful Answers
    • 10,000+ points
    • 1,001-10,000 points
    • 501-1,000 points
    • 5-500 points