By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,136 Members | 1,087 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,136 IT Pros & Developers. It's quick & easy.

Redirect a form back to the calling script

P: 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,

Jan 17 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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=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
Jan 17 '07 #2

P: n/a
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/

--
Jock

Jan 17 '07 #3

P: n/a
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.javascript where they know a lot more of recent
developments than I do.

Regards,
Erwin Moller
Jan 17 '07 #4

P: n/a
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.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:
---------------------------
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
Jan 17 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.