Skip navigation
Currently Being Moderated

$updateGoTo to javaScript problem

Jul 12, 2012 10:10 AM

Tags: #javascript #dynamic #dw #updategoto

Hi all, I have a simple question, when I create an update form on DW it works fine redirencting to another web page, but since I have a huge list on a dynamic site i need it to go to my last valid page, the problem is that when I use javaScript:history.back() it doesn't work can anybody help?

 

Here is my code:

 

$updateGoTo = "pautas-disciplina-sm.php"; // this works

$updateGoTo = "javaScript:history.back()"; // this doesn't

 

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

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

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

  }

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

}

 
Replies
  • Currently Being Moderated
    Jul 12, 2012 3:08 PM   in reply to yalp.com.br

    yalp.com.br wrote:

     

    $updateGoTo = "pautas-disciplina-sm.php"; // this works

    $updateGoTo = "javaScript:history.back()"; // this doesn't

    No surprise whatsoever that it doesn't work. Your second line is simply assigning a string (plain text) to $updateGoTo.

     

    PHP is a server-side language. JavaScript is a normally client-side language. It's like trying to speak Spanish in Brazil. The languages might look similar, but they're completely different. Although a Brazilian might be able to work out what a Spanish speaker is saying, to PHP, JavaScript might as well be Klingon. Won't work.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 12, 2012 3:42 PM   in reply to yalp.com.br

    As David says, this ain't gonna work. Why not just pass the page's url in a hidden form field?

     
    |
    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