Redirect a form back to the calling script

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sandman

    #1

    Redirect a form back to the calling script

    Hi there,
    So here is the situation I'm in. My PHP script does something like
    this:

    1. Update a DB (only once)
    2. Send some post data to another PHP script (only once)
    3. Output some stuff related to 1 and 2.

    I've done #2 by using input type="hidden" on a form, like so:
    print "<form action='../dir/register.php' method='post'
    name='DirReg'>" ;
    print "<input type='hidden' name='username' value='$sname' >";
    print "<br>";
    print "<input type='hidden' name='email' value='$email' >";
    print "<br>";
    print "<input type='hidden' name='password' value='$pwd' >";
    print "<br>";
    print "<input type='hidden' name='password2 ' value='$pwd' >";
    print "<br>";
    print "</forum>";

    print "<script language=javasc ript>";
    print "document.DirRe g.submit()";
    print "</script>";
    }

    This works awesomely, but the problem is that control flows to the
    script that performs the action on the form. I kinda want to send this
    stuff to the PHP script, and then continue processing the rest of PHP
    script #1. In the UNIX world I would put the form job in the
    background. Is there a way of doing that here?

    Thanks,

  • Erwin Moller

    #2
    Re: Redirect a form back to the calling script

    Sandman wrote:
    Hi there,
    So here is the situation I'm in. My PHP script does something like
    this:
    >
    1. Update a DB (only once)
    2. Send some post data to another PHP script (only once)
    3. Output some stuff related to 1 and 2.
    >
    I've done #2 by using input type="hidden" on a form, like so:
    print "<form action='../dir/register.php' method='post'
    name='DirReg'>" ;
    print "<input type='hidden' name='username' value='$sname' >";
    print "<br>";
    print "<input type='hidden' name='email' value='$email' >";
    print "<br>";
    print "<input type='hidden' name='password' value='$pwd' >";
    print "<br>";
    print "<input type='hidden' name='password2 ' value='$pwd' >";
    print "<br>";
    print "</forum>";
    >
    print "<script language=javasc ript>";
    print "document.DirRe g.submit()";
    print "</script>";
    }
    >
    This works awesomely, but the problem is that control flows to the
    script that performs the action on the form. I kinda want to send this
    stuff to the PHP script, and then continue processing the rest of PHP
    script #1. In the UNIX world I would put the form job in the
    background. Is there a way of doing that here?
    >
    Thanks,

    Hi,

    Yes, you can do the post without any clientcontact by using a package name
    CURL.


    With CURL you can also catch the output of the called script (#2), maybe to
    check for errors or something like that.

    Also, stop using:
    <script language="javas cript">

    and switch to:

    <script type="text/javascript">

    Regards,
    Erwin Moller

    Comment

    • John Dunlop

      #3
      OT - javascript MIME type

      Erwin Moller:
      <script type="text/javascript">
      The MIME type registry marks text/javascript as
      obsolete. Are there any browser issues with the MIME type
      application/javascript?



      --
      Jock

      Comment

      • Erwin Moller

        #4
        Re: OT - javascript MIME type

        John Dunlop wrote:
        Erwin Moller:
        >
        ><script type="text/javascript">
        >
        The MIME type registry marks text/javascript as
        obsolete. Are there any browser issues with the MIME type
        application/javascript?
        >

        >
        Hi John,

        Hmm, interesting.
        I'll ask that in comp.lang.javas cript where they know a lot more of recent
        developments than I do.

        Regards,
        Erwin Moller

        Comment

        • Erwin Moller

          #5
          Re: OT - javascript MIME type

          Erwin Moller wrote:
          John Dunlop wrote:
          >
          >Erwin Moller:
          >>
          >><script type="text/javascript">
          >>
          > The MIME type registry marks text/javascript as
          >obsolete. Are there any browser issues with the MIME type
          >application/javascript?
          >>
          >http://www.iana.org/assignments/media-types/text/
          >>
          >
          Hi John,
          >
          Hmm, interesting.
          I'll ask that in comp.lang.javas cript where they know a lot more of recent
          developments than I do.
          >
          Regards,
          Erwin Moller
          Hi John,

          In case you don't read comp.lang.javas cript, I received a few answers:
          response1:
          -------------------
          My IE Mac run only text/javascript
          My FF2 run with both
          Didn't try with my other browsers
          -------------------


          response2:
          ---------------------------
          In comp.lang.php I advised somebody to skip using:
          <script language="javas cript">
          and use:
          <script type="text/javascript">
          That advice makes sense if you look at the HTML 4.01 or XHTML 1.0
          specification where the type attribute on the script element is
          mandatory while the language attribute is deprecated. So to have valid
          HTML 4.01 or XHTML 1.0 markup you script elements need to have a type
          attribute.
          On the other hand that type attribute was introduced to allow
          standarized MIME types as type names only text/javascript is used at
          several places in the HTML 4.01 specification but was not a registered
          MIME type when the HTML 4.01 specification was published and that status
          remained that way for several years.
          <http://www.rfc-editor.org/rfc/rfc4329.txtchan ged that, so
          text/javascript (and text/ecmascript which the SVG 1.0/1.1 specification
          uses) are now officially registered MIME types but they have at the same
          time been obsoleted in favor of application/javascript and
          application/ecmascript.
          --------------------------------------

          So if you want to run on Mac IE, use text/javascript.
          Regards,
          Erwin Moller

          Comment

          Working...