Redirect a form back to the calling script

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

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

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'
   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=javascript>";
  print "document.DirReg.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?


Re: Redirect a form back to the calling script

Sandman wrote:

Quoted text here. Click to load it


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

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="javascript">

and switch to:

<script type="text/javascript">

Erwin Moller

OT - javascript MIME type

Erwin Moller:

Quoted text here. Click to load it

    The MIME type registry marks text/javascript as
obsolete.  Are there any browser issues with the MIME type


Re: OT - javascript MIME type

John Dunlop wrote:

Quoted text here. Click to load it

Hi John,

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

Erwin Moller

Re: OT - javascript MIME type

Erwin Moller wrote:

Quoted text here. Click to load it

Hi John,

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

Quoted text here. Click to load it

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  
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.
< changed 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  

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

Site Timeline