The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End PHP Back Button

  • This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #46543

    I am a bit new to the PHP realm..

    I am trying to make this PHP back button work outside of a website. I am creating a widget, that can submit a form through PHP. But if there is an error in the form, it redirects to an Error page, and I need a back button in the error page to get back to the form. Since this is not in a web browser, there is no back button. And since I am not technically using the internet, the javascript:history.go(-1); code doesn’t work either, becasue there is no stored history in a widget. Basically, I have a local HTML file, that links to a PHP file on a server, and I need to get back to the HTML file (original page or the form).

    That is what i have now in my PHP code, and can’t figure out how to get it to work. And I don’t really understand the PHP code given above.

    I saw a post the tried to explain this with this code:

    $url = htmlspecialchars($_SERVER);
    echo “back“;

    But I don’t quite understand that, and tried copying and pasting into my code with no success.

    Any help is greatly appreciated. Thank you!


    Why go through all this trouble? Just link to the page the form is on.


    I can’t because the form is a local file. The PHP file is on a server, while the HTML file is in the Widget file locally.


    May I ask what exactly you’re trying to do? Not your problem but the overall goal.


    I am embedding a widget into iBooks Author, and the widget is a submission form. So the Widget contains the HTML file with my CSS and JavaScript files, and the PHP is on a server. The form POSTs to the PHP server, and gives an error message if, for example, the e-mail is incorrect. But, my problem is the only way to get to the form (local HTML file) is to completely close out of the widget, out of the book, and reload the book, which obviously erases everything inputted to the widget as well.

    I need a way to get back to the local file, or to post the error message without leaving the original form page.

    Thank you for all your help.


    I agree with **chrisburton** here – that there may be a cleaner way to accomplish this. However, to directly answer your question – you could use [$_SERVER Variables]( “$_SERVER Variables”). Something like this might work:

    0): ?>
    “>Go Back


    Why don’t you do some client-side validation before posting data. And use AJAX… quick search resulted in:

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘Back End’ is closed to new topics and replies.