473,715 Members | 3,033 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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,

Jan 17 '07 #1
4 1951
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.
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="javas cript">

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.javas cript 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.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
Jan 17 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
9977
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 performing the validation check on the values that were entered into the form, I simply repost the form to perform the PHP validation. If any of the values that have been entered into the form are incorrect, I display a warning message on the screen...
1
8016
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 the domain server address. (these changes were in the $recipient and $referers section) I have set up the form and can get the form to email me the results. I have two main problems. The first one is that I am trying to get the form to go to a...
10
9369
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"); ?> Should it not redirect to www.google.com? I can't get the header() function to redirect. I'm trying to take an online reservation... the customer fills out
2
2566
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 processing of user forms, the submit button takes the user back to the same URL (with different CGI data). This is ok because I don't want the user bookmarking anywhere between when the first form is started and the last form finished. Once the...
5
2969
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 post method and either logs the user in our out given the information from the form. but every pages use sessions and cookies, if the user is successfully logged in then the cookies and session values are updated, (as well as MySQL).
2
9173
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 performing a redirect when I had left in print "Content-type:text/html\n\n";
6
5692
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: <%@ LANGUAGE=JScript %> <HTML> <HEAD>
8
4613
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) that need to be validated when the submit button is clicked. Instead of the standard alert window popping up (which I have now), I want the radio button background color to change from the table color (E2E2E2) to red (FF0000) for both buttons...
1
7294
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 and Brand I need to make some changes on a a number of brands in a Category
0
8821
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9340
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9196
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9103
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9047
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6646
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4477
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4738
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2118
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.