dadamssg Posted January 18, 2009 Share Posted January 18, 2009 im sure theres an easy way to make one, but php will get an error when you try to put a html back button....i just want a button that does exactly what your browsers back button does, suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/141385-back-button/ Share on other sites More sharing options...
premiso Posted January 18, 2009 Share Posted January 18, 2009 Javascript. <a href="javascript:history.go(-1);">Go Back!</a> With php you could use sessions but javascript mimics the browser back button. Quote Link to comment https://forums.phpfreaks.com/topic/141385-back-button/#findComment-740069 Share on other sites More sharing options...
dadamssg Posted January 18, 2009 Author Share Posted January 18, 2009 im not familiar with javascript at all...i tried just copy pasting that, didn't work..caused an error earlier in my script...don't understand that. my question is do you need to have an open javascript tag to let the browser know thats what your using? or should just copy pasting that work? Quote Link to comment https://forums.phpfreaks.com/topic/141385-back-button/#findComment-740076 Share on other sites More sharing options...
premiso Posted January 18, 2009 Share Posted January 18, 2009 my javascript is hazy: http://javascript.internet.com/navigation/back-button.html <a href="#" onClick="history.go(-1)">Back</a> Should work. Quote Link to comment https://forums.phpfreaks.com/topic/141385-back-button/#findComment-740078 Share on other sites More sharing options...
Kieran Menor Posted January 18, 2009 Share Posted January 18, 2009 Or using $_SERVER['HTTP_REFERER'] as the back button URL. It wouldn't work if the browser sends an incorrect referer, though. Quote Link to comment https://forums.phpfreaks.com/topic/141385-back-button/#findComment-740088 Share on other sites More sharing options...
dadamssg Posted January 18, 2009 Author Share Posted January 18, 2009 the javascript worked perfect. but whats the code for javascript to make it a button and not just a text link? any clue? Quote Link to comment https://forums.phpfreaks.com/topic/141385-back-button/#findComment-740099 Share on other sites More sharing options...
premiso Posted January 18, 2009 Share Posted January 18, 2009 the javascript worked perfect. but whats the code for javascript to make it a button and not just a text link? any clue? If you look in the code at the site I posted you would have found this: <input type=button value="Back" onClick="history.go(-1)"> Quote Link to comment https://forums.phpfreaks.com/topic/141385-back-button/#findComment-740100 Share on other sites More sharing options...
dropfaith Posted January 18, 2009 Share Posted January 18, 2009 my javascript is hazy: http://javascript.internet.com/navigation/back-button.html <a style="border: 2px outset rgb(204, 204, 204); padding: 2px; color: rgb(102, 102, 102); text-decoration: none;" href="#" onClick="history.go(-1)">Back</a> Should work. heh just style the link should work and give you the most options inputs without forms i keep forgetting is that valid? Quote Link to comment https://forums.phpfreaks.com/topic/141385-back-button/#findComment-740104 Share on other sites More sharing options...
premiso Posted January 18, 2009 Share Posted January 18, 2009 Not sure if it is valid, but it works. Quote Link to comment https://forums.phpfreaks.com/topic/141385-back-button/#findComment-740105 Share on other sites More sharing options...
Kieran Menor Posted January 18, 2009 Share Posted January 18, 2009 I don't think it is, but <button onclick="history.go(-1);">Back</button> should be... Quote Link to comment https://forums.phpfreaks.com/topic/141385-back-button/#findComment-740106 Share on other sites More sharing options...
dadamssg Posted January 18, 2009 Author Share Posted January 18, 2009 <a href='#' onClick='history.go(-1)'><input type='submit' name='Edit' value='Edit'></a> works perfect. thanks guys. my whole thing is for the user to submit a form, and then display the results in a table for them to check over and if its not right click the edit button which will send them back to the form WITH the information they entered still in the fields. thanks again Quote Link to comment https://forums.phpfreaks.com/topic/141385-back-button/#findComment-740112 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.