473,378 Members | 1,544 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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=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
4 1939
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: TG | last post by:
I have a validation form that must behave differently based on the results of a PHP validation check. I have a post command at the top of my form that calls itself. I don't leave the form when...
1
by: Damo | last post by:
Could someone please help me. I am a newbie at PHP. I downloaded formail.php Version 5.0 from Jacks scripts( http://www.dtheatre.com/scripts/ )and changed the required areas to my email address and...
10
by: Bob Garbados | last post by:
forgive my ignorance, as I'm new to php coming from a ms background... If I create a page named redirect.php and it's only content is: <?php header("Location: http://www.google.com"); ?>...
2
by: Steven Feil | last post by:
I was wondering if the there was a meta tag that would cause a standard browser to reload a URL "immediately"? The reason why I want to do the is as follows. I have a PHP script that does some...
5
by: Simon | last post by:
Hi, I have a Login.php page that logs the user in and out. I has two forms within the page, (depending on what we are trying to do), either one to log in or out. The form calls itself using a...
2
by: bagsmode | last post by:
Hi, I'm trying to set a session cookie and then redirect, however I get the error: Status: 302 Moved Location: /index.cgi I thought I recall getting an error like this when I first tried...
6
by: Rich | last post by:
Hello, I need users to access a data entry asp page via a login page. If they bookmark the data entry asp I want to redirect them to the login page (using IIS). Here is what I had in mind: ...
8
by: photoboy | last post by:
I have racked by brain long enough on this, so now I need the help of someone who knows what they are doing. Here is what I am trying to achieve: First, I have two radio buttons (both unchecked)...
1
by: gnawz | last post by:
Hi guys, I have a couple of php files that perform various tasks. I will use fields in my system and provide code as well I need help as follows: My database contains the fields Category...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.