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));
}
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.
North America
Europe, Middle East and Africa
Asia Pacific