A question that has certainly been asked before and I've googled etc.
for answers with no certain outcome...
I'd like my PHP script to redirect the client browser to another page,
POSTing some data at the same time. (To take them back to an html page
showing a form that needs correcting because some data is missing.)
I believe this is either tricky or not possible from what I've seen, but
I'd just like to see what others think currently...
It's a little annoying because plain redirecting is easy and plain POST
to a URL (and get the results back) is easy too, but combining them
seems to be another matter...
thanks!
alex 11 3036
Alex Hunsley wrote: A question that has certainly been asked before and I've googled etc. for answers with no certain outcome...
I'd like my PHP script to redirect the client browser to another page, POSTing some data at the same time. (To take them back to an html page showing a form that needs correcting because some data is missing.) I believe this is either tricky or not possible from what I've seen, but I'd just like to see what others think currently...
It's a little annoying because plain redirecting is easy and plain POST to a URL (and get the results back) is easy too, but combining them seems to be another matter...
thanks! alex
use a combination of sessions, post and get.
If you want the source code limited to one file then pass parameters on
the $_GET parameter list. If you use sessions then pass some of the info
via session variables, also use $_POST forms, all sorts of ways, depends
what works for your requirements
NSpam wrote: Alex Hunsley wrote:
A question that has certainly been asked before and I've googled etc. for answers with no certain outcome...
I'd like my PHP script to redirect the client browser to another page, POSTing some data at the same time. (To take them back to an html page showing a form that needs correcting because some data is missing.) I believe this is either tricky or not possible from what I've seen, but I'd just like to see what others think currently...
It's a little annoying because plain redirecting is easy and plain POST to a URL (and get the results back) is easy too, but combining them seems to be another matter...
thanks! alex use a combination of sessions, post and get.
If you want the source code limited to one file then pass parameters on the $_GET parameter list.
I want to avoid just using a GET style URL as it looks unprofessional.
If you use sessions then pass some of the info via session variables, also use $_POST forms,
What exactly do you mean by $_POST forms?
thanks
alex
all sorts of ways, depends what works for your requirements
Alex Hunsley wrote: What exactly do you mean by $_POST forms?
He means from html:
<from action="bla.php" METHOD="POST">
<input type="text" name="color">
</form>
And from php:
$color = $_POST["color"];
Good luck.
Regards,
Erwin Moller
Alex Hunsley wrote: I'd like my PHP script to redirect the client browser to another page, POSTing some data at the same time.
Not going to work. If your page sends out a POST request, it
must receive response. You can show that response to the client,
but you may have broken links in it.
There is an alternative, however. If both pages are on the same
server, you can write POST data into session variables and then
redirect without arguments and have the second page retrieve data
from those session variables.
Cheers,
NC
"Alex Hunsley" <la**@tardis.ed.ac.molar.uk> wrote in message
news:lw*******************@fe1.news.blueyonder.co. uk... A question that has certainly been asked before and I've googled etc. for answers with no certain outcome...
I'd like my PHP script to redirect the client browser to another page, POSTing some data at the same time. (To take them back to an html page showing a form that needs correcting because some data is missing.) I believe this is either tricky or not possible from what I've seen, but I'd just like to see what others think currently...
It's a little annoying because plain redirecting is easy and plain POST to a URL (and get the results back) is easy too, but combining them seems to be another matter...
thanks! alex
The following will redirect a POST request.
header("HTTP/1.0 307 Temporary Redirect");
header("Location: $url");
Works the last time I check in IE.
Erwin Moller wrote: Alex Hunsley wrote:
What exactly do you mean by $_POST forms?
He means from html: <from action="bla.php" METHOD="POST"> <input type="text" name="color"> </form>
And from php: $color = $_POST["color"];
Good luck.
Regards, Erwin Moller
Oh right, I see, thanks!
alex
NC wrote: Alex Hunsley wrote:
I'd like my PHP script to redirect the client browser to another page, POSTing some data at the same time.
Not going to work. If your page sends out a POST request, it must receive response. You can show that response to the client, but you may have broken links in it.
Yeah, I was ruminating on this earlier on and it is a good point!
I may just receive the resulting HTML (from my post operation) and just
shove that out to the browser. There is an alternative, however. If both pages are on the same server, you can write POST data into session variables and then redirect without arguments and have the second page retrieve data from those session variables.
Ah, thanks for that clarification, I think one of the other repliers was
hinting at this but they were very vague about it... Cheers, NC
cheers
alex
Chung Leong wrote: "Alex Hunsley" <la**@tardis.ed.ac.molar.uk> wrote in message news:lw*******************@fe1.news.blueyonder.co. uk...
A question that has certainly been asked before and I've googled etc. for answers with no certain outcome...
I'd like my PHP script to redirect the client browser to another page, POSTing some data at the same time. (To take them back to an html page showing a form that needs correcting because some data is missing.) I believe this is either tricky or not possible from what I've seen, but I'd just like to see what others think currently...
It's a little annoying because plain redirecting is easy and plain POST to a URL (and get the results back) is easy too, but combining them seems to be another matter...
thanks! alex
The following will redirect a POST request.
header("HTTP/1.0 307 Temporary Redirect"); header("Location: $url");
Works the last time I check in IE.
I may well be able to do it this way... thanks for the tip!
alex
Alex Hunsley wrote: A question that has certainly been asked before and I've googled etc. for answers with no certain outcome...
Was Flavell's "Redirect in response to POST transaction"[1] one of
those results?
Even though a 307 response is probably your best bet, it still doesn't
exactly guarantee success (at least in a Web context). Storing the
data between requests, or perhaps using cURL or sockets to perform the
second POST request and return the result, might be better. I haven't
tried either, though.
[snip]
Mike
[1] <URL:http://ppewww.ph.gla.ac.uk/~flavell/www/post-redirect.html>
--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Alex Hunsley wrote: Erwin Moller wrote: Alex Hunsley wrote:
What exactly do you mean by $_POST forms?
He means from html: <from action="bla.php" METHOD="POST"> <input type="text" name="color"> </form>
And from php: $color = $_POST["color"];
Good luck.
Regards, Erwin Moller
Oh right, I see, thanks!
alex
Anytime.
If you are someday in doubt what you mean, just ask me.
;-)
Regards,
Erwin Moller
Michael Winter wrote: Alex Hunsley wrote:
A question that has certainly been asked before and I've googled etc. for answers with no certain outcome...
Was Flavell's "Redirect in response to POST transaction"[1] one of those results?
Yup, I did find that one. Even though a 307 response is probably your best bet, it still doesn't exactly guarantee success (at least in a Web context). Storing the data between requests, or perhaps using cURL or sockets to perform the second POST request and return the result, might be better. I haven't tried either, though.
Yeah, the article seems to say that results are a little unpredictable
and I don't think it would be as reliable as I want...
thanks!
alex This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Victor |
last post by:
I need to redirect to another web page, but that redirect will include the
submission of form data. So, unlike ServerXMLHTTP which stays on the
originating web page, I need the script to redirect...
|
by: Darren Oakey |
last post by:
G'day - I have a problem that I just can't figure out how to solve, and
would desperately love some help!!!
We have an existing product (which we don't have control over) which is a
web server...
|
by: DotNetGruven |
last post by:
I've got a page that does a search... There is an ImageButton on it that
allows the user to reset the search.
The Click Handler for the button clears out the Data and then redirects to
the same...
|
by: Keith Patrick |
last post by:
I have to do some programmatic redirects (in several pages) based on URLs I
am given from an external source. The URLs have querystrings at the end,
but one in particular is about 240 chars long,...
|
by: ETK |
last post by:
Hi,
I need to POST data to some aspx page and after that redirect to this page
( page isn't on my local server where my page is). Is it possible to do this
from aspx code on server side?
Thanks,...
| |
by: David |
last post by:
I need to redirect to a page and HTTP Post data. The
Response.Redirect does not work and the HTTPREQUEST option calls the
page and waits for a response, but I need to transfer control to the...
|
by: Brano |
last post by:
HI all,
I am looking to post XML data to a particular page and also redirect to
the same page.
I have coded a WebReqest code in page0 that posts the XML to the page1
and then the page1 in its...
|
by: =?Utf-8?B?QWxleCBNYWdoZW4=?= |
last post by:
I am trying to create ASPX code which will allow me to redirect a user to
another site with POST data. I figure that the best way to do this is with
JavaScript to the client. Here's what I'm doing:...
|
by: UKuser |
last post by:
Hi,
I'm not sure if this can be done as I've searched the web and this
forum.
I am using an online merchant provider and I must post certain
variables to their webforms through a form on my...
|
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,...
|
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,...
| |
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...
|
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...
|
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...
|
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...
|
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...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |