开发者

question about POST and redirect [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

开发者_JAVA百科

Closed 8 years ago.

Improve this question

So I have a html form and I have an URL where it will be submitted, say the URL is www.myformsubmit.com/form_submit.php. This form_submit.php will give me a text saying if everything is correct in the form or prints out an error message.

What I want to do is that to do is that after the form is submitted to form_submit.php I want to redirect users to a thank you page. My question, is there a way to do this without having to touch the form_submit.php, if yes how?


With your current setup, you can't redirect to another page without modifying form_submit.php.

You can have the form submit to itself, and then do something like this:

<?php
    // Optionally, also make sure that there are no errors.
    if (isset($_POST["SomeInputValue"])):
    {
        // Must be BEFORE any output is sent!
        header("Location: /thank_you.php");
    }

    else
    {
        // Display the form page.
    }
?>


My question, is there a way to do this without having to touch the form_submit.php, if yes how?

You want to check if everything is fine from form_submit.php but you do not want to post data to it? I think this is really not possible.


is there a way to do this without having to touch the form_submit.php, if yes how?

The short answer would be no. To correctly answer your question we need to know why you cannot modify form_submit.php. This is because a simple line of code could be added to redirect to a "thank you" page when the form is correctly filled in.

(Will edit this accordingly as the question is developped)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜