prudens Posted March 2, 2008 Share Posted March 2, 2008 echo "<a href=" . "javascript:history.back();" . ">Return</a>"; How come it doesn't work?? Link to comment https://forums.phpfreaks.com/topic/94010-javascript-in-php/ Share on other sites More sharing options...
ignace Posted March 2, 2008 Share Posted March 2, 2008 javascript is a client-side language, php a server-side language use instead <?php if (array_key_exists('HTTP_REFERER', $_SERVER)) { header('Location: ' . $_SERVER['HTTP_REFERER']); } else { echo "<a href=\"#\" onclick=\"javascript:history.go(-1);\">click here to go back</a>"; } ?> Link to comment https://forums.phpfreaks.com/topic/94010-javascript-in-php/#findComment-481626 Share on other sites More sharing options...
fnairb Posted March 2, 2008 Share Posted March 2, 2008 You are losing your quotes around javascript:history.back();. The site won't let me save the example code for some reason so here is another example instead... echo '<a href="jscript:hist.back();">Return</a>'; Link to comment https://forums.phpfreaks.com/topic/94010-javascript-in-php/#findComment-481627 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.