Announcement

Collapse
No announcement yet.

Two actions; one form?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Two actions; one form?

    Anyone know if this is possible? One to execute, other to redirect to a page. If not, how can I make it redirect to another page after submitting?

    Or I want the browser to refresh but when I do this, the browser says

    To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier
    Which I don't want...

    Thanks

  • #2
    I tried onclick and onsubmit for <form> but both didn't work.. so I did it for the submit button:


    Form/submit:
    Code:
    onclick="submitTwice(this.form)"
    Java:

    Code:
      function submitTwice(f){
    f.action = 'index.html';
    f.target='index.html';
    f.submit();
    f.action = '<?php echo $_SERVER['PHP_SELF'] ?>';
    f.target='';
    f.submit();
    }
    For some reason "index.html" must be next to f.action and f.target for it to go there but the problem is it opens in a new window?

    EDIT:

    f.target='_self';

    breaks the redirection and f.target='self'; still opens in new window? Is there something else I must put in to open in the same frame?
    Last edited by karimali831; 29-08-09, 12:11 PM.

    Comment


    • #3
      You may want to look at something like parent.frames, though not really having used javascript much, it might not be what you're after, though may give some insight on how to achieve it.
      Hexo
      -------
      The man that knows how, is always working for the man that knows why

      Comment


      • #4
        do you mean like a forum? as in when you post you are taken to a page then redirected back to the thread?

        One way is using the meta redirect, or you could use php header redirect

        Comment

        Working...
        X