Results 1 to 3 of 3

Thread: Help...

  1. #1
    Join Date
    Jul 2014


    I am building a site, and here is my question.

    I have a submit form, and that is fine, it directs you to another html page.

    What I want is: when you are at the page it re-directs you to, I want to ensure that you cannot be on that page without having clicked the previous submit button.

    Thank you for your time.

  2. #2
    Join Date
    Apr 2014
    Hi, you could pass a random query string to the page. For example, http://www.mypage-submitted-form.com...veryouwanthere

    Then on a javascript onload function check if the query string parameter has been supplied, if not then redirect away from that page to another.

    Thus, on form submission and redirect provide the query string, if its not there the user should never be able to get to site.

    Hope that helps.


  3. #3
    Join Date
    Mar 2012
    You do not need redirects. What you can do is:

    1. Make the web page (that has the form) the target of the action.

    2. Include logic to display the input form if the form is no complete, or not valid.

    3. Only display the response if the input is complete and valid.

    If writing it in PHP (which I recommend because JavaScript is insecure), in outline it could be something like:

    <!DOCTYPE html>
    <html lang="en">
    /*  tests set $ok to 'Y' if 
        input is complete and valid
        otherwise $ok = 'N' */
    if ($ok='Y') {?>
        <!-- put output div(s) here -->
    <?php ;} else { ?>
        <form action="">
        <!-- put input form here -->
    <?php ;} ?>
    The page must be called "something.PHP" instead of "something.HTML" so that the server knows to interpret the instructions. The browser sees none of the PHP code, it just receives either the output div(s) (if the input is complete and valid) or the input form (if not).

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center