Connecting Tech Pros Worldwide Help | Site Map

Redirect a form back to the calling script

  #1  
Old January 17th, 2007, 02:45 AM
Sandman
Guest
 
Posts: n/a
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=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?

Thanks,

  #2  
Old January 17th, 2007, 09:45 AM
Erwin Moller
Guest
 
Posts: n/a

re: Redirect a form back to the calling script


Sandman wrote:
Quote:
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=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?
>
Thanks,

Hi,

Yes, you can do the post without any clientcontact by using a package name
CURL.
http://www.php.net/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="javascript">

and switch to:

<script type="text/javascript">

Regards,
Erwin Moller
  #3  
Old January 17th, 2007, 10:15 AM
John Dunlop
Guest
 
Posts: n/a

re: Redirect a form back to the calling script


Erwin Moller:
Quote:
<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/

--
Jock

  #4  
Old January 17th, 2007, 01:45 PM
Erwin Moller
Guest
 
Posts: n/a

re: Redirect a form back to the calling script


John Dunlop wrote:
Quote:
Erwin Moller:
>
Quote:
><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.javascript where they know a lot more of recent
developments than I do.

Regards,
Erwin Moller
  #5  
Old January 17th, 2007, 04:05 PM
Erwin Moller
Guest
 
Posts: n/a

re: Redirect a form back to the calling script


Erwin Moller wrote:
Quote:
John Dunlop wrote:
>
Quote:
>Erwin Moller:
>>
Quote:
>><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.javascript 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.javascript, 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:
---------------------------
Quote:
In comp.lang.php I advised somebody to skip using:
<script language="javascript">
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.txtchanged 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
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit answers 0 November 14th, 2005 04:15 AM
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit answers 0 November 13th, 2005 11:37 PM
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit answers 0 November 13th, 2005 09:56 PM
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit answers 0 November 13th, 2005 03:15 AM