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 3057
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.blueyonde r.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("Locatio n: $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.blueyonde r.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("Locatio n: $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.a c.uk/~flavell/www/post-redirect.html>
--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail. 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 to the page that I'm
submitting the POST data to (without pressing a submit button).
Any suggestions?
Thanks,
Victor
|
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 that will produce a PDF document as a report - but from an XML
file that is "POST"ed to the document server.
I have a listbox that lists various reports that are available, and when you
select a report, I want that particular PDF to appear. So,...
|
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 page with Response.Redirect("Search.Aspx", true);
Sometimes the code in Page_Load within the IsPostBack part of the if
statement runs and sometimes it doesn't. IN other words, sometimes
IsPostBack is true and sometimes it is not!
|
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, so I need to programmatically
redirect to it. Unfortunately, I can't find a way to do it. There is no
Response.Form or Response.Attributes (Request has Form and Params, but they
are read-only). I've tried using AppendHeader to pass my K/V pairs...
|
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,
Dalibor
| |
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
page. Eg. Redirect and POST data.
The only way I can see to do this is to format a HTML/POST, with
Javascript, page and use the RESPONSE.WRITE option.
Thanks
|
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 PageLoad event reads and parses the XML it
then saves the data it recieved to cookies. But using this technique
the code returns to the page0. I have then used
response.redirect(page1) but the cookies are lost...
|
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:
I have a JavaScript function that looks like this:
function DoPostRedir()
{
document.MainFrm.method = "POST";
document.MainFrm.action = "http://XXX.YYY.com/Help/";
|
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 website.
The issue is that I need to gauge whether a user has any items in
their basket to decide which page I redirect them too. I could
|
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...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
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,...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 we have to send another system
| |
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...
| |